Click here to Skip to main content
15,609,332 members
Articles / Desktop Programming / MFC
Posted 7 Aug 2001


8 bookmarked

Choose Color Dialog

Rate me:
Please Sign up or sign in to vote.
1.17/5 (4 votes)
7 Aug 20011 min read
This article demonstrates a tool for previewing foreground and background color combinations.

Sample Image - cclrdlg.gif


I often wonder what color combinations will look like when selecting colors to use for a control. I also find myself wondering what the red, green, and blue values for an RGB value are. The Choose Color utility is meant to be used to preview foreground and background color selections as well as decode an RGB value into its red, green, and blue components.

To preview a color, just enter the red green values. To decode an RGB value into its red, green, and blue components, just enter an RGB value and leave the RGB edit control. When it loses the focus, the red, green, and blue values will be displayed for the entered RGB value.

The utility shows the common MFC example for handling the dynamic setting of the foreground and background colors for a control. If you view the ColorStatic.cpp file, you will see the implementation of the CColorStatic class. It has member functions for setting the foreground and background color of the static control. The main workhorse of the class is the CtlColor function.


This article has no explicit license attached to it, but may contain usage terms in the article text or the download files themselves. If in doubt, please contact the author via the discussion board below.

A list of licenses authors might use can be found here.

Written By
Software Developer
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

QuestionHow to change the Color Palatte of Gif File. Pin
pubududilena6-Jul-04 17:54
pubududilena6-Jul-04 17:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.