ColorDialog MyDialog = new ColorDialog();
// Keeps the user from selecting a custom color.
MyDialog.AllowFullOpen = true;
// Allows the user to get help. (The default is false.)
MyDialog.ShowHelp = true;
// Sets the initial color select to the current text color.
MyDialog.Color = this.pictureBox2.BackColor;
//MyDialog. // Update the text box color if the user clicks OK
if (MyDialog.ShowDialog() == DialogResult.OK)
{
this.pictureBox2.BackColor = MyDialog.Color;
this.pictureBox2.ForeColor = MyDialog.Color;
newIni.IniWriteValue("WaterStr", IniFontColor[flag - 1].ToString(), this.pictureBox2.BackColor.ToString());
}
this.pictureBox1.Invalidate(pictureBox1.ClientRectangle);
这样选择颜色后
保存到INI文件
发现
有些颜色MyDialog.Color 有时候是英文BLACK(选纯黑色的时候)
有时候是RGB 的(非纯色的时候)如下FontColor1=Color [White]
FontColor2=Color [Black]
FontColor3=Color [A=255, R=236, G=57, B=26]
FontColor4=Color [Black]
FontColor5=Color [Black]怎么样让他都都变成RGB格式的(因为我要用到颜色透明度 必须要用RGB)
// Keeps the user from selecting a custom color.
MyDialog.AllowFullOpen = true;
// Allows the user to get help. (The default is false.)
MyDialog.ShowHelp = true;
// Sets the initial color select to the current text color.
MyDialog.Color = this.pictureBox2.BackColor;
//MyDialog. // Update the text box color if the user clicks OK
if (MyDialog.ShowDialog() == DialogResult.OK)
{
this.pictureBox2.BackColor = MyDialog.Color;
this.pictureBox2.ForeColor = MyDialog.Color;
newIni.IniWriteValue("WaterStr", IniFontColor[flag - 1].ToString(), this.pictureBox2.BackColor.ToString());
}
this.pictureBox1.Invalidate(pictureBox1.ClientRectangle);
这样选择颜色后
保存到INI文件
发现
有些颜色MyDialog.Color 有时候是英文BLACK(选纯黑色的时候)
有时候是RGB 的(非纯色的时候)如下FontColor1=Color [White]
FontColor2=Color [Black]
FontColor3=Color [A=255, R=236, G=57, B=26]
FontColor4=Color [Black]
FontColor5=Color [Black]怎么样让他都都变成RGB格式的(因为我要用到颜色透明度 必须要用RGB)
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货