Csharp: Winform 顏色選擇器 Color convert RGB and RGB convert Color
生活随笔
收集整理的這篇文章主要介紹了
Csharp: Winform 顏色選擇器 Color convert RGB and RGB convert Color
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
/// <summary>/// 選擇顏色/// </summary>/// <param name="sender"></param>/// <param name="e"></param>private void button2_Click(object sender, EventArgs e){//是否選擇了顏色if (colorDialog1.ShowDialog(this) == DialogResult.OK){//System.Drawing.Color.FromArgbthis.textBox2.Text = ColorTranslator.ToHtml(colorDialog1.Color);this.textBoxA.Text = colorDialog1.Color.A.ToString();this.textBoxB.Text = colorDialog1.Color.B.ToString();this.textBoxG.Text = colorDialog1.Color.G.ToString();this.textBoxR.Text = colorDialog1.Color.R.ToString();this.textBoxArgb.Text = colorDialog1.Color.ToArgb().ToString();//1//this.button1.BackColor = ColorTranslator.FromHtml(this.textBox2.Text.Trim());//2//this.button1.BackColor =Color.FromArgb(int.Parse(this.textBoxArgb.Text.Trim()));//3this.button1.BackColor = Color.FromArgb(int.Parse(this.textBoxR.Text.Trim()), int.Parse(this.textBoxG.Text.Trim()), int.Parse(this.textBoxB.Text.Trim()));}}/// <summary>/// 選擇字體/// </summary>/// <param name="sender"></param>/// <param name="e"></param>private void button3_Click(object sender, EventArgs e){if (fontDialog1.ShowDialog(this) == DialogResult.OK){this.textBox1.Text = fontDialog1.Font.ToString();}}
?
轉(zhuǎn)載于:https://www.cnblogs.com/geovindu/archive/2013/04/24/3039915.html
總結(jié)
以上是生活随笔為你收集整理的Csharp: Winform 顏色選擇器 Color convert RGB and RGB convert Color的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 英雄连2重装甲指挥所怎么建
- 下一篇: 推荐:一个VS插件——CopySourc