ColorPicker.h
上传用户:lj3531212
上传日期:2007-06-18
资源大小:346k
文件大小:2k
源码类别:

绘图程序

开发平台:

Visual C++

  1. #if !defined(AFX_COLORPICKER_H__52F28BCF_DBD4_49A1_8293_1B7FBFB8735D__INCLUDED_)
  2. #define AFX_COLORPICKER_H__52F28BCF_DBD4_49A1_8293_1B7FBFB8735D__INCLUDED_
  3. #if _MSC_VER > 1000
  4. #pragma once
  5. #endif // _MSC_VER > 1000
  6. class CColorPicker : public CButton
  7. {
  8. // Construction
  9. public:
  10. CColorPicker();
  11. virtual ~CColorPicker();
  12. // Attributes
  13. protected:
  14.    CRect m_rectFill,m_rectSel;
  15. // Operations
  16. public:
  17. void SetColor(COLORREF ref);
  18. void SetBuddy(HWND hWnd);
  19. COLORREF GetColor();
  20. void GetColor(CString& strColor);
  21. void        SetFillRect(CRect rect);
  22. void        SetFillRect(int left,int top,int right,int bottom);
  23. CRect       GetFillRect();
  24. void        SetSelRect(CRect rect);
  25. void        SetSelRect(int left,int top,int right,int bottom);
  26. CRect       GetSelRect();
  27. // CPoint m_OldPos;
  28. //CPoint m_CurrentPos;
  29. // Overrides
  30. // ClassWizard generated virtual function overrides
  31. //{{AFX_VIRTUAL(CColorPicker)
  32. protected:
  33. virtual LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam);
  34. //}}AFX_VIRTUAL
  35. // Implementation
  36. private:
  37. void DestroyPaletteWindow();
  38. BOOL CreatePaletteWindow();
  39. static LONG FAR PASCAL PaletteWndProc(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam);
  40. // Generated message map functions
  41. protected:
  42. //{{AFX_MSG(CColorPicker)
  43. afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  44. afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
  45. afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
  46. afx_msg void OnPaint();
  47. afx_msg void OnMouseMove(UINT nFlags, CPoint point);
  48. afx_msg LRESULT OnMouseLeave(WPARAM wParam, LPARAM lParam);
  49. afx_msg LRESULT OnMouseHover(WPARAM wParam, LPARAM lParam);
  50. afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
  51. //}}AFX_MSG
  52. DECLARE_MESSAGE_MAP()
  53. private:
  54. HWND m_hwndBuddy;
  55. COLORREF m_CurrentColor;
  56. HWND m_hPaletteWnd;
  57. BOOL m_bPaletteWndActive;
  58. HCURSOR m_hCursorStraw;
  59.     BOOL        m_bMouseDown;
  60. };
  61. /////////////////////////////////////////////////////////////////////////////
  62. //{{AFX_INSERT_LOCATION}}
  63. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  64. #endif // !defined(AFX_COLORPICKER_H__52F28BCF_DBD4_49A1_8293_1B7FBFB8735D__INCLUDED_)