For many years I have used Chris Maunder's excellent colour picker control. I have extended this control with the following features:
- Custom colours - added functions to allow setting and retrieving 16 custom colours.
- Window colours - added 16 commonly used Windows colours to popup (
- Colours sorted by hue - popup now displays colours arranged more or less by hue.
This is what the new colour picker looks like:
How To Use
XColourPicker into your app, you first need to add the following files to your project:
Then use the resource editor to add a button control to your dialog, and use the Class Wizard to attach a member variable to that control.
Next, include the header file XColourPicker.h in the dialog's header file. Then replace the
CButton definition with
CXColourPicker. Now you are ready to start using
demo shows how to use
The demo dialog processes color changes in the
LRESULT CXColourPickerTestDlg::OnColourChange(WPARAM, LPARAM lParam)
if (lParam == IDC_TEXT_COLOUR)
else if (lParam == IDC_BACKGROUND_COLOUR)
if (m_ctlTextColour.GetColor() == m_ctlBackgroundColour.GetColor())
"The text and background colours are identical.\r\n"
"The text will not be readable.",
m_rgbText = m_ctlTextColour.GetColor();
m_rgbBackground = m_ctlBackgroundColour.GetColor();
Version 1.1 - 2006 January 10
This software is released into the public domain. You are free to use it in any way you like, except that you may not sell this source code. If you modify it or extend it, please consider posting new code here for everyone to share. This software is provided "as is" with no expressed or implied warranty. I accept no liability for any damage or loss of business that this software may cause.
I attended St. Michael's College of the University of Toronto, with the intention of becoming a priest. A friend in the University's Computer Science Department got me interested in programming, and I have been hooked ever since.
Recently, I have moved to Los Angeles where I am doing consulting and development work.
For consulting and custom software development, please see www.hdsoft.org