65.9K
CodeProject is changing. Read more.
Home

Xgui - A set of Photoshop-like color pickers

starIconstarIconstarIconstarIcon
emptyStarIcon
starIcon

4.50/5 (5 votes)

Apr 12, 2002

viewsIcon

68487

downloadIcon

1976

An MFC Compliant adobe Photoshop-like Color Picker from xgui

Introduction

Bobi B has written a very cool Photoshop-like color picker (you can click here to see how cool it is), but since this is compiled into a DLL, it is very hard to use with existing MFC projects. I decided therefore to create a simple class to mimic CGTColorDialogDlg - but this time based on CDialog.

Sample Image - xgui-extension.jpg

How to use it:

Very easy! Simply add the following code in the header file of the class where you want to display the Color Picker Dialog:

#include "GTColorDialogDlg.h"

And in the .cpp file:

CGTColorDialogDlg dlg
dlg.SetColor(RGB(0,0,255));
int nResponse = dlg.DoModal()
if (nResponse == IDOK)
{
    COLORREF crReturn = dlg.GetColor();
}

Technical Details

The Color Picker Dialog is constructed using the following classes:

  1. GTColorWellWnd - (GTColorWellWnd.h, GTColorWellWnd.cpp)
  2. GTColorSliderWnd - (GTColorSliderWnd.h,GTColorSliderWnd.cpp)
  3. GTColorSelectorWnd - (GTColorSelectorWnd.h,GTColorSelectorWnd.cpp)
  4. CGTColorDialogDlg - (CGTColorDialogDlg.h,CGTColorDialogDlg.cpp

The class inheritance diagrams are as follows:

Sample Image - A_Hierarchy_Chart.jpg