gradpal.h
上传用户:f091118568
上传日期:2007-01-03
资源大小:53k
文件大小:2k
源码类别:

对话框与窗口

开发平台:

Visual C++

  1. // GRADPAL.H
  2. // Written by chensu
  3. // m_nPaintDir:
  4. // GPD_TTOB - top to bottom,
  5. // GPD_BTOT - bottom to top,
  6. // GPD_LTOR - left to right,
  7. // GPD_RTOL - right to left
  8. #define    GPD_TTOB 0
  9. #define    GPD_BTOT 1
  10. #define    GPD_LTOR 2
  11. #define    GPD_RTOL 3
  12. // m_nPaintRGB: a combination of one or more of the following values
  13. // i.e.:
  14. // GPC_RED - Red
  15. // GPC_GREEN - Green
  16. // GPC_BLUE - Blue
  17. // GPC_RED | GPC_GREEN - Yellow
  18. // GPC_RED | GPC_BLUE - Purple
  19. // GPC_GREEN | GPC_BLUE - Cyan
  20. // GPC_RED | GPC_GREEN | GPC_BLUE - Grey
  21. #define    GPC_RED 0x0001
  22. #define    GPC_GREEN  0x0002
  23. #define    GPC_BLUE 0x0004
  24. //-----------------------------------------------------------------------------
  25. class CGradpalApp : public CWinApp
  26. {
  27. public:
  28. virtual BOOL InitInstance();
  29. };
  30. //-----------------------------------------------------------------------------
  31. //-----------------------------------------------------------------------------
  32. class CGradpalWnd : public CFrameWnd
  33. {
  34. public:
  35. CGradpalWnd();
  36. inline BOOL CreateWnd();
  37. protected:
  38. afx_msg BOOL OnQueryNewPalette();
  39. afx_msg void OnPaletteChanged(CWnd *pFocusWnd);
  40. afx_msg void OnPaint();
  41. DECLARE_MESSAGE_MAP()
  42. private:
  43. const int m_nPaintSteps, m_nPaintDir;
  44. const UINT m_nPaintRGB;
  45. CPalette m_Pal;
  46. void PaintGradiantRect(CDC *pDC, const RECT &rect) const;
  47. BOOL CreateGradPalette();
  48. };
  49. //-----------------------------------------------------------------------------
  50. //-----------------------------------------------------------------------------
  51. inline BOOL CGradpalWnd::CreateWnd()
  52. {
  53. return this->Create(NULL, _T("Gradient Palette"));
  54. }
  55. //-----------------------------------------------------------------------------
  56. // End of GRADPAL.H