The COLOR sample demonstrates how to use the CColorDialog class to create color in an application.
You can create a color by typing in numerical values indicating the relative intensities of red, green, and blue (RGB), or by selecting a color from a table or a color spectrum.
To create a color based on RGB values, enter an integer between 0 and 255 in each of the RGB boxes that appear the opening dialog box. The higher the value you enter for each primary color, the greater the intensity of that color in the created color. Once you have selected the values, press the Apply button and the resulting color will appear in a box.
Alternatively, you can press the Choose Color button and a dialog box will pop up. This dialog box contains a table containing basic colors, an empty table for defining your own custom colors, a color spectrum, and a Color/Solid box where the currently selected color is displayed. To select a color, simply click on it in the basic color table, and it will appear in the Color/Solid box. To select a color that is not included in the basic colors, click at the desired color in the color spectrum, and the new color will appear in the Color/Solid box. To add the color in the Color/Solid box to the custom color table, click the Add to Custom Colors button.
Note The Define Custom Colors button will not appear if the screen size is less then the width of the dialog box — for example, if it is less than 465 pixels wide — or if the current palette contains 4 or fewer colors.
This sample demonstrates the following keywords:
You can find the COLOR project files in the Wce\Samples\Mfc\COLOR directory.
For information on the Windows CE platforms that support this sample, see MFC for Windows CE Samples.