C#颜色对话框(WPF可用)

System.Windows.Forms.ColorDialog colorDialog = new System.Windows.Forms.ColorDialog();
//允许使用该对话框的自定义颜色
colorDialog.AllowFullOpen = true;
colorDialog.FullOpen = true;
colorDialog.ShowHelp = true;
//初始化当前文本框中的字体颜色,
colorDialog.Color = System.Drawing.Color.Black;
//当用户在ColorDialog对话框中点击"取消"按钮
colorDialog.ShowDialog();
string strColor=System.Drawing.ColorTranslator.ToHtml(colorDialog.Color);
this.colorBtn.Content = strColor;

posted @ 2019-08-09 11:31  搬砖的L先生  阅读(1060)  评论(0编辑  收藏  举报