c#颜⾊字符串转换为颜⾊
private string sColor;
private Color mColor;
private Color mNewColor;
private void panel1_Click(object sender, EventArgs e)
{
DialogResult dr = colorDialog1.ShowDialog();
if (dr == System.Windows.Forms.DialogResult.OK)
{
字符串是什么颜mColor = colorDialog1.Color;
sColor = "#" + mColor.R.ToString("x2") + mColor.G.ToString("x2") + mColor.B.ToString("x2");
sColor = "#" + mColor.A.ToString("x2") + mColor.R.ToString("x2") + mColor.G.ToString("x2") + mColor.B.ToString("x2"); mNewColor = System.Drawing.ColorTranslator.FromHtml(sColor);
label1.BackColor = mNewColor;
panel1.BackColor = mNewColor;
}
}

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。