![]() |
Desktop Development »
Miscellaneous »
Lists, Menus, Choosers
Intermediate
CColorChooser an IDE style Color PickerBy Norm .netCColorChooser an IDE style Color Picker |
VC6, Windows, MFC, Dev
|
|
Advanced Search Add to IE Search |
|
|
|
||||||||||||||||
![]() |
![]() |
![]() |
Visual Basic is certainly not my cuppa tea, but the Visual Basic IDE does have some good ideas which applications can benefit from. One these is the Color Chooser popup window which allows the user to select a desired color. I've extended the control to include the Web Colors which are found on the new Visual Studio .NET IDE.
During a recent project I needed to design a color chooser and I turned to the VB IDE for 'help'.
The window components contained in the project are show below:

Due to the lose coupling of the design CPaletteWnd, CSysColorWnd or
CWenColorWnd can be used
in isolation if so required in another project. The CColorChooser contains all the functionality
and routes specific user messages back to the parent via PostMessage. Custom
colors are persistent to the application and are serialized during CColorChooser
construction and destruction (stored in the registy).
The project covers owner draw controls and have to create a custom control.
ColorChooser.h & ColorChooser.cpp PaletteWnd.h & PaletteWnd.cpp WebColorWnd.h & WebColorWnd.cpp SysColorWnd.h & SysColorWnd.cpp
CColorChooser is to be implemented add the
include file.
#include "ColorChooser.h"
CColorChooser in the class
class CYourView : public CView... { public: CColorChooser* m_pWndColorChooser;
CYourView:: CYourView()
{
m_pWndColorChooser = NULL;
void CPaletteTestView::OnRButtonUp(UINT nFlags, CPoint point) { if (m_pwndChooser == NULL) { ClientToScreen(&point); m_pwndChooser = new CColorChooser(point, this, m_crCurr); }
LRESULT CPaletteTestView::OnColorChanged(WPARAM wParam, LPARAM lParam)
{
m_crCurr = lParam; // Color is contained in lParam
delete m_pwndChooser;
m_pwndChooser = NULL;
RedrawWindow();
return 0;
}
LRESULT CPaletteTestView::OnColorChooserClose(WPARAM wParam, LPARAM lParam)
{
delete m_pwndChooser;
m_pwndChooser = NULL;
return 0;
}
This article forms a small part of the future article covering a property list control.
Any bugs, enhancements or suggestions please don't hesitate to contact me.
| You must Sign In to use this message board. | ||||||||
|
||||||||
|
||||||||
|
||||||||
|
||||||||
General
News
Question
Answer
Joke
Rant
Admin
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 4 Oct 2001 Editor: Chris Maunder |
Copyright 2001 by Norm .net Everything else Copyright © CodeProject, 1999-2009 Web20 | Advertise on the Code Project |