SkinSliderCtrl.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #pragma once
  2. // CSkinSliderCtrl
  3. #include "SkinUI.h"
  4. #include "ISkinControl.h"
  5. class SKINUI_CLASS CSkinSliderCtrl : public CSliderCtrl,public ISkinControl
  6. {
  7. DECLARE_DYNAMIC(CSkinSliderCtrl)
  8. //资源定义
  9. public:
  10. CImageEx * m_pBackImg, * m_pThumImg, * m_pDisImg, * m_pBtImg, * m_pTraceImg;
  11. //变量定义
  12. protected:
  13. BOOL m_bPress, m_bHover, m_bMouseTracking; //按钮状态
  14. bool m_bDragging; //拖放标识
  15. CRect m_rcThumRect; //滑块区域
  16. CRect m_rcChannelRect; //轨迹区域
  17. CSize m_szThum; //滑块大小
  18. //函数定义
  19. public:
  20. //构造函数
  21. CSkinSliderCtrl();
  22. //析构函数
  23. virtual ~CSkinSliderCtrl();
  24. //重载函数
  25. protected:
  26. //设置属性
  27. virtual void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue);
  28. //创建控件
  29. virtual BOOL CreateControl(CWnd* pParentWnd);
  30. public:
  31. //设置资源
  32. BOOL SetBackImage(LPCTSTR lpszFileName,bool bFixed = true);
  33. //设置资源
  34. BOOL SetThumImage(LPCTSTR lpszFileName);
  35. //设置资源
  36. BOOL SetDisImage(LPCTSTR lpszFileName);
  37. //设置资源
  38. BOOL SetButtonImage(LPCTSTR lpszFileName);
  39. //设置资源
  40. BOOL SetTraceImage(LPCTSTR lpszFileName,CONST LPRECT lprcNinePart=NULL);
  41. //功能函数
  42. public:
  43. //滑块位置
  44. void SetThumbRect(int nPos=0);
  45. //设置轨迹
  46. void SetChannelRect();
  47. //设置位置
  48. void SetPos(int nPos);
  49. //消息映射
  50. public:
  51. //鼠标离开
  52. afx_msg LRESULT OnMouseLeave(WPARAM wparam, LPARAM lparam);
  53. //绘制消息
  54. afx_msg void OnPaint();
  55. //窗口销毁
  56. afx_msg void OnDestroy();
  57. //鼠标移动
  58. afx_msg void OnMouseMove(UINT nFlags, CPoint point);
  59. //左键按下
  60. afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  61. //左键抬起
  62. afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
  63. //背景重绘
  64. afx_msg BOOL OnEraseBkgnd(CDC* pDC);
  65. protected:
  66. DECLARE_MESSAGE_MAP()
  67. };