ColourPicker.h
上传用户:cn05999
上传日期:2020-06-29
资源大小:84k
文件大小:2k
源码类别:

Static控件

开发平台:

Visual C++

  1. #if !defined(AFX_COLOURPICKER_H__9200FF1E_28AB_41F3_A870_84A72BEDA649__INCLUDED_)
  2. #define AFX_COLOURPICKER_H__9200FF1E_28AB_41F3_A870_84A72BEDA649__INCLUDED_
  3. #if _MSC_VER > 1000
  4. #pragma once
  5. #endif // _MSC_VER > 1000
  6. // ColourPicker.h : header file
  7. //
  8. #include "ColourPopup.h"
  9. #define CP_MODE_TEXT 1
  10. #define CP_MODE_BK 2
  11. /////////////////////////////////////////////////////////////////////////////
  12. // CColourPicker window
  13. void AFXAPI DDX_ColourPicker(CDataExchange* pDX,int nIDC,COLORREF& crColour);
  14. class CColourPicker : public CButton
  15. {
  16. DECLARE_DYNCREATE(CColourPicker)
  17. // Construction
  18. public:
  19. CColourPicker();
  20. void SetBkColour(COLORREF crColourBk);
  21. COLORREF GetBkColour(){return m_crColourBk;}
  22. void SetTextColour(COLORREF crColourText);
  23. COLORREF GetTextColour(){return m_crColourText;}
  24. void SetTrackSelection(BOOL bTracking =TRUE){m_bTrackSelection=bTracking;}
  25. BOOL GetTrackSelection() {return m_bTrackSelection;}
  26. void SetSelectionMode(UINT nMode) {m_nSelectionMode=nMode;}
  27. UINT GetSelectionMode() { return m_nSelectionMode;}
  28. COLORREF GetColour()
  29. {
  30. return (m_nSelectionMode==CP_MODE_TEXT)?
  31. GetTextColour():GetBkColour();
  32. }
  33. void SetColour(COLORREF crColour)
  34. {
  35. (m_nSelectionMode==CP_MODE_TEXT)? 
  36. SetTextColour(crColour):SetBkColour(crColour);
  37. }
  38. // Attributes
  39. public:
  40. // Operations
  41. public:
  42. // Overrides
  43. // ClassWizard generated virtual function overrides
  44. //{{AFX_VIRTUAL(CColourPicker)
  45. public:
  46. virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
  47. protected:
  48. virtual void PreSubclassWindow();
  49. //}}AFX_VIRTUAL
  50. // Implementation
  51. public:
  52. void SetWindowSize();
  53. virtual ~CColourPicker();
  54. afx_msg LONG OnSelEndOK(UINT lParam, LONG wParam);
  55. afx_msg LONG OnSelEndCancel(UINT lParam, LONG wParam);
  56. afx_msg LONG OnSelChange(UINT lParam, LONG wParam);
  57. // Generated message map functions
  58. protected:
  59. BOOL m_bActive,
  60. m_bTrackSelection;
  61. COLORREF m_crColourBk;
  62. COLORREF m_crColourText;
  63. UINT m_nSelectionMode;
  64. CRect m_ArrowRect;
  65. CString m_strText;
  66. //{{AFX_MSG(CColourPicker)
  67. afx_msg void OnClicked();
  68. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  69. //}}AFX_MSG
  70. DECLARE_MESSAGE_MAP()
  71. };
  72. /////////////////////////////////////////////////////////////////////////////
  73. //{{AFX_INSERT_LOCATION}}
  74. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  75. #endif // !defined(AFX_COLOURPICKER_H__9200FF1E_28AB_41F3_A870_84A72BEDA649__INCLUDED_)