BLOG.CSHARPHELPER.COM: Display custom colors in the color selection dialog in C#
Display custom colors in the color selection dialog in C#
The color selection dialog can store custom colors in the 16 boxes on its lower left (see the picture). Your code can initialize those colors by setting the dialog's CustomColors property to an array of integers representing the colors.
One easy way to define the colors is using hexadecimal format. The first two digits represent a color's blue component, the next two its green component, and the last two its red component.
The following code shows how this example initializes the custom colors for the background color selection dialog shown in the picture.
You can set the dialog's FullOpen property to true to indicate that the dialog should show its custom color selection area on the right when it opens. This example uses the following code to make the background color dialog start with this area open and the foreground color dialog start with this area closed.
Comments