C#,自定义调色板

时间:2013-07-08 01:31:43

标签: c# colorbox

我必须创建类似于http://www.certapro.com/certapro-fad-palette-paint-colors.aspx的调色板。具有不同RGB组合的自定义调色板。最简单的方法是什么? [我是否需要为每种自定义颜色插入图片框,否则无论如何都要使视觉工作室颜色对话框看起来像这样?)

1 个答案:

答案 0 :(得分:0)

ColourDialogue.CustomColours属性是一个int数组,用于定义对话框显示的自定义颜色。最简单的方法是定义一个硬编码的int数组。如果您知道这些颜色的Web十六进制值,则可以使用十六进制表示法,如下所示:

System.Windows.Forms.ColorDialog MyDialog = new ColorDialog();
// Allows the user to select or edit a custom color.
MyDialog.AllowFullOpen = true ;
// Assigns an array of custom colors to the CustomColors property
// Note that the most significant byte is the alpha value,
// so most of the time it will remain FF
MyDialog.CustomColors = new int[]{ 0xFF974724, 0xFFe7eae3 };

如果您不知道颜色的十六进制值,我建议您在浏览器上安装EyeDropper添加,以便从网页(或任何非Chrome浏览器的等效文件)中挑选颜色。

相关问题