Download demo project (James Twine's version) - 26 Kb
Download source files (James Twine's version) - 8 Kb
Download demo project (Mark Jackson's version) - 18 Kb
Download source files (Mark Jackson's version) - 2 Kb
James Twine originally based this code on earlier work by Baldvin Hansson.
Mark Jackson (www.mjsoft.co.uk) has expanded this to add a "Custom..." option at the bottom of the list which displays the
standard colour picker dialog, and has also added DDX data exchange. The code has also been improved and tidied up in many other ways.
CColorPickerCB class implements a Combobox
that displays colors as well as the name of the colors. Colors may be added or
removed at runtime, and the control can be queried for the
value, or the name of the selected color. You can also set the selected color.
The control correctly handles selection, enabled and disabled
drawing. Since the control uses strings for display, the colors can be sorted.
To use this control, create a Drop List Combobox with the
Owner Draw Fixed and Has Strings styles. Attach a
CColorPickerCB to the control, and off you go!
The initialization routine populates the color picker with a
color selection that is a subset of the X11 colorset, and are the colors that
are recognized by IE.
Note that the control will use 1/4 (one fourth) of its width
for the color block, and the rest, minus a few pixels, for the color text. Be
sure you make it wide enough.
Thanks to Marcel Galema for finding a bug with my inverted
(selected) color usage, and suggesting a fix for it.
Thanks also to Paul Wardle for providing DDX routines.
Here is a list of public functions in the
COLORREF GetSelectedColorValue(void); CString GetSelectedColorName(void); void SetSelectedColorValue(COLORREF crColor); void SetSelectedColorName(PCSTR cpColor);
void InitializeDefaultColors( void );
bool RemoveColor(PCSTR cpColor); bool RemoveColor(COLORREF crColor); int AddColor(PCSTR cpName, COLORREF crColor);
Programming since the age of 10, started professionally at the age of 17. Currently involved in both Client and Server side development on Win32 platforms for MC/HA/FT financial applications. Development experience with Win32, Win16, Linux and other flavors of Unix.
Extensive multithreaded development experience on Windows platforms using the Win32 SDK, and MFC.
Experience with HA/FT n-tiered Client/Server systems as well as GUI apps of varying complexity. Some experience with Game developement.
Having learned that the stuff you can barely get away with doing Client-side apps just does not cut it in the real "Server World", I am amazed how many 'professionals' cannot tell the difference between "works" and "correct" or try to (mis)use VB and/or MFC on server-side development projects, never considering that just because it RUNS, does not mean it runs WELL.
Lastly, I am also a collector of arcade games, and can perform repairs, conversions, etc. Search for my name, you will find me on lots of arcade-related documents and sites.
Sites of interest(?):