ISkinControl.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #ifndef CONTROL_HEAD_FILE
  2. #define CONTROL_HEAD_FILE
  3. #pragma once
  4. #include "SkinUI.h"
  5. #include "XmlManager.h"
  6. class SKINUI_CLASS ISkinControl
  7. {
  8. protected:
  9. HDC m_hParentDC;
  10. CImageEx *m_pImageScroll; //滚动资源
  11. DWORD m_dwTextAlign;
  12. HFONT m_Font;
  13. //文字颜色
  14. public:
  15. COLORREF m_colDefText; //默认文字
  16. COLORREF m_colNormalText; //正常文字
  17. COLORREF m_colSelectText; //高亮文字
  18. COLORREF m_colDisableText; //失效文字
  19. COLORREF m_colReadOnlyText; //只读文字
  20. COLORREF m_colBack; //窗口背景
  21. COLORREF m_colFrameNormal; //边框颜色
  22. public:
  23. BOOL m_bTransparent;
  24. CWnd * m_pOwnWnd;
  25. CPoint m_ptPosition;
  26. CSize m_szSize;
  27. int m_FixedPostion[2];
  28. public:
  29. ISkinControl(void);
  30. virtual ~ISkinControl(void);
  31. public:
  32. //设置属性
  33. virtual void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue);
  34. //设置属性
  35. virtual void ParseItem(CXmlNode *root){}
  36. //创建控件
  37. virtual BOOL CreateControl(CWnd* pParentWnd){ return TRUE; }
  38. public:
  39. //矩形居中
  40. void CalcCenterRect(RECT& rcDest, int cx, int cy, RECT& rcCenter);
  41. //绘制背景
  42. void DrawParentWndBg(HWND hWnd,HDC hDC);
  43. //设置背景
  44. void SetParentBack(HDC hDC){ m_bTransparent = true; m_hParentDC = hDC;}
  45. BOOL TrackMouseLeave(HWND hWnd);
  46. //字体设置
  47. public:
  48. //设置字体
  49. void SetCtrlFont(HFONT hFont);
  50. //获取字体
  51. HFONT GetCtrlFont();
  52. //文字位置
  53. void SetTextAlign(WORD wTextAlign);
  54. //文字颜色
  55. public:
  56. //默认文本
  57. void SetDefText(COLORREF colText);
  58. //正常文本
  59. void SetNormalText(COLORREF colText);
  60. //正常文本
  61. void SetSelectText(COLORREF colText);
  62. //失效文本
  63. void SetDisableText(COLORREF colText);
  64. //边框颜色
  65. public:
  66. //正常状态
  67. void SetFrameColor(COLORREF colFrame);
  68. //正常状态
  69. void SetBackColor(COLORREF colBack);
  70. //设置函数
  71. public:
  72. //
  73. void SetUnTransparent();
  74. //滚动条
  75. public:
  76. //加载资源
  77. BOOL SetScrollImage(CWnd * pOwn,LPCTSTR pszFileName);
  78. //
  79. void RemoveScorll();
  80. };
  81. #endif