PropertyGridItemStringButton.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #pragma once
  2. class CPropertyGridItemStringButton : public CPropertyGridItem
  3. {
  4. public:
  5. // 构造函数,参数说明:
  6. // strCaption -属性名称
  7. // hNotifyWnd -接收自定义消息的窗口句柄
  8. // hNotifyMsg -自定义消息
  9. CPropertyGridItemStringButton (CString strCaption, LPCTSTR strValue = NULL, HWND hNotifyWnd = NULL, UINT nNotifyMsg = 0);
  10. // 构造函数,参数说明:
  11. // nID -属性ID
  12. // hNotifyWnd -接收自定义消息的窗口句柄
  13. // hNotifyMsg -自定义消息
  14. CPropertyGridItemStringButton (UINT nID, LPCTSTR strValue = NULL, HWND hNotifyWnd = NULL, UINT nNotifyMsg = 0);
  15. virtual ~CPropertyGridItemStringButton();
  16. protected:
  17. // 当属性值由于用户输入而改变时,调用此函数
  18. //virtual void SetValue(CString strValue);
  19. //virtual BOOL OnDrawItemValue(CDC& dc, CRect rcValue);
  20. //virtual CRect GetValueRect();
  21. // 当用户点击按钮时,调用此虚函数
  22. virtual void OnInplaceButtonDown();
  23. // 当用户双击属性项时,调用此虚函数
  24. virtual void OnLButtonDblClk();
  25. HWND m_hNotifyWnd; // 接收自定义消息的窗口句柄
  26. UINT m_nNotifyMsg; // 自定义消息
  27. CString m_strTitle; // 字串内容;
  28. public:
  29. // 设置属性值:value-新的属性值
  30. void SetTitle(CString strValue);
  31. // 获取属性值
  32. double GetTitle();
  33. // 把一个字符串对象绑定到属性项
  34. void BindToString(CString* pBindString)
  35. {
  36. m_pBindString = pBindString;
  37. if (m_pBindString)
  38. SetValue(*m_pBindString);
  39. }
  40. };