Color Picker

Environment: Visual C++

A very COOL color pick dialog with a color dropper like Photoshop and Frontpage 2000

Introduction

File reference:

Prebuild version: ColorPicker16_exe.zip 120 KB (A dialog for choosing colors)

Class Ref: ColorPickerClass.chm 119KB (Build by UCanCode DocVizor)

Source Code:ColorPicker16_src.zip 65KB (Build with MS Visual C++ 6.0)

First three are in demo project file below. Source code available below too.

The key features are as follows:

  1. ColorPicker provides a default color panel, which includes over 144 frequent colors.
  2. ColorPicker provides a custom button for opening Windows Common Color Select Dialog. You can select more color here.
  3. ColorPicker provides the color contrast between current selection and new selection.
  4. ColorPicker provides a select button , when you hold the left button of mouse on select button, the cursor has become to a color dropper like Photoshop and Frontpage 2000. You can get any color on the screen via this dropper.
  5. ColorPicker shows both the RGB value and Hex Value of the current selection color./li>
  6. The color panel will load new palette as soon as the system color range has been changed.
  7. ColorDropper provides 6 color panels for choosing. You can change it during run time.
  8. The most important thing is that, we provide the full source code (100% MFC), !-.
  9. (New)Full keyboard support.

Screen Shot:

(Screen 1)

(Screen 2)

(Screen 3)

How to use it:

 The steps for usage are as follows:

1.Add code in those head files where you want to display Color Picker Dialog.

#include "FODropColorButton.h"

enum { IDD = IDD_DIALOG_COLORPICKER };
CFODropColorButton m_wndColor3;
CFODropColorButton m_wndColor2;
CFODropColorButton m_wndColor1;
CFOHyperLink m_newVersion;
//}}AFX_DATA

2.Add code in those files/events when you need to get color value.

CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CNewPickerDlg)
DDX_Control(pDX, IDC_FO_TEST_BUTTON3, m_wndColor3);
DDX_Control(pDX, IDC_FO_TEST_BUTTON2, m_wndColor2);
DDX_Control(pDX, IDC_FO_TEST_BUTTON1, m_wndColor1);
//}}AFX_DATA_MAP
DDX_FODropColorButton(pDX,IDC_FO_TEST_BUTTON1,crColor1);
DDX_FODropColorButton(pDX,IDC_FO_TEST_BUTTON2,crColor2);
DDX_FODropColorButton(pDX,IDC_FO_TEST_BUTTON3,crColor3);

Everything is OK!

Technical Details

Color Picker Dialog is constructed with classes as follows;

1.CFOColorButton File Reference#:FOColorButton.h, FOColorButton.cpp

2.CFOColorCellObj File Reference#:FOColorCellObj.h, FOColorCellObj.cpp

3.CFOColorDialogObj File Reference#:FOColorDialog.h, FOColorDialog.cpp

4.CFOColorPaletteControl File Reference#:FOColorPaletteControl.h, FOColorPaletteControl.cpp

5.CFODropPaletteWndFile Reference#:FODropPaletteWnd.h, FODropPaletteWnd.cpp

6.CFODropColorButton File Reference#:FODropColorButton.h, FODropColorButton.cpp

7.CFODropColorPaletteControl File Reference#:FODropColorPaletteControl.h, FODropColorPaletteControl.cpp

8.CFODropColorPaletteWnd File Reference#:FODropColorPaletteWnd.h, FODropColorPaletteWnd.cpp

9.CFOPopupColorPaletteWndFile Reference#:FOPopupColorPaletteWnd.h, FOPopupColorPaletteWnd.cpp

All of the class inheritance diagrams are as follows:

CWnd

\s

CObject

\s

CStatic

CButton

\s

CDialog

Click here to view Our online profile and report bugs.

Update V1.6(New!)

  • Add full keyboard supprt,you can use left arrow,right arrow,up arrow,down arrow and tab key to select color.
  • Fixed a few bugs.

Update V1.5

  • Add color palette support for color dialog.
  • Add a cool drop color picker button.
  • Fixed a few bugs.

Update V1.2

  • Add a specify image static class.
  • Add support 3D color table.
  • Fixed a few bugs.

Downloads

Download demo project - 213 Kb
Download source - 64 Kb


Comments

  • color match design is easy now.

    Posted by Legacy on 01/15/2002 12:00am

    Originally posted by: Gennady

    Very nice work! Thanks for sharing code!

    Reply
  • Nice, but...

    Posted by Legacy on 01/08/2002 12:00am

    Originally posted by: Serguei Batchila

    Hello

    I's a very nice dialog, the only problem is that your 'Select...' button looks ugly.
    I guess you never tried to test it on another computer.
    Everything is wrong about this button:
    1. It has wrong size (I have 'Large Fonts')
    2. It has wrong color (I have 'brick' color scheme)
    3. It has wrong font (it doesn't use the system font)
    4. It's not pressable.

    I haven't read you explanation, maybe you have a good excuse for all these errors, I know only that these errors are fixable and without fixing them it's hard to say that this dialog can be a part of commercial product.

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Learn How A Global Entertainment Company Saw a 448% ROI Every business today uses software to manage systems, deliver products, and empower employees to do their jobs. But software inevitably breaks, and when it does, businesses lose money -- in the form of dissatisfied customers, missed SLAs or lost productivity. PagerDuty, an operations performance platform, solves this problem by helping operations engineers and developers more effectively manage and resolve incidents across a company's global operations. …

  • Live Event Date: December 18, 2014 @ 2:00 p.m. ET / 11:00 a.m. PT The Internet of Things (IoT) incorporates physical devices into business processes using predictive analytics. While it relies heavily on existing Internet technologies, it differs by including physical devices, specialized protocols, physical analytics, and a unique partner network. To capture the real business value of IoT, the industry must move beyond customized projects to general patterns and platforms. Check out this upcoming webcast …

Most Popular Programming Stories

More for Developers

RSS Feeds