winfrom 点击按钮button弹框显示颜色集

1.窗体托一个按钮button;

2.单击事件:

 1  private void btnForeColor_Click(object sender, EventArgs e)
 2         {
 3             using (ColorDialog cdialog = new ColorDialog())
 4             {
 5                 cdialog.AnyColor = true;
 6                 if (cdialog.ShowDialog() == DialogResult.OK)
 7                 {
 8                     this.ForeColor = cdialog.Color;
 9                     this.btnForeColor.BackColor = this.ForeColor;
10                 }
11             }
12         }

 

posted @ 2017-11-25 15:52  Bonnie_W  阅读(529)  评论(0编辑  收藏  举报