Click here to Skip to main content
15,897,891 members
Articles / Desktop Programming / MFC

A color picker dialog with a color dropper like Photoshop and Frontpage 2000

Rate me:
Please Sign up or sign in to vote.
4.83/5 (10 votes)
23 Jan 20022 min read 95K   4.3K   29  
A color picker and dropper that extends the standard Windows dialogs to behave like Photoshop or Frontpage 2000
// Copyright UCanCode Software Technology Inc, All Rights Reserved
// You can contact us.
// Support@UCanCode.net
// http://www.ucancode.net
/********************************************************************/
// FODropColorPaletteWnd.h: interface for the CFODropColorPaletteWnd class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_FODROPCOLORPALETTEWND_H__526F9B94_F5BB_11D5_A4D3_525400EA266C__INCLUDED_)
#define AFX_FODROPCOLORPALETTEWND_H__526F9B94_F5BB_11D5_A4D3_525400EA266C__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "FODropColorPaletteControl.h"

class CFODropColorPaletteWnd : public CWnd
{
// Construction
public:
	CFODropColorPaletteWnd();

// Attributes
public:

	//Create
	BOOL Create(DWORD dwStyle,
		CRect rcPos, 
		CWnd* pParent,
		UINT nID,
		COLORREF crColor,
		BOOL bPopup = FALSE);

// Operations
	//Get ColorControl
	CFODropColorPaletteControl *GetColorControl()	{ return m_pColorControl; }

protected:

	// The pointer to ColorControl
	CFODropColorPaletteControl *m_pColorControl;

	// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CFODropColorPaletteWnd)
	protected:
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	virtual void PreSubclassWindow();
	//}}AFX_VIRTUAL

// Implementation
public:

	// Destructor
	virtual ~CFODropColorPaletteWnd();

	// Generated message map functions
protected:
	//{{AFX_MSG(CFODropColorPaletteWnd)
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnMButtonDblClk(UINT nFlags, CPoint point);
	afx_msg void OnMButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnMButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
	afx_msg void OnDestroy();
	afx_msg void OnPaint();
	afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnCancelMode();
	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
	afx_msg void OnSize(UINT nType, int cx, int cy);
	// System color change.
	afx_msg void OnSysColorChange();
	//}}AFX_MSG
	afx_msg LONG OnSelectDayOK(UINT wParam, LONG lParam);
	afx_msg LONG OnSelectDayCancel(UINT wParam, LONG lParam);
	afx_msg LONG OnSelectCustom(UINT wParam, LONG lParam);
	DECLARE_MESSAGE_MAP()
protected:

	// The pointer to Notify Window
	CWnd *pNotifyWnd;
};

#endif // !defined(AFX_FODROPCOLORPALETTEWND_H__526F9B94_F5BB_11D5_A4D3_525400EA266C__INCLUDED_)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
United States United States
jack Mesic is the president of UCanCode Software Technology,Inc..

Comments and Discussions