| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- #pragma once
- class CPropertyGridItemStringButton : public CPropertyGridItem
- {
- public:
- // 构造函数,参数说明:
- // strCaption -属性名称
- // hNotifyWnd -接收自定义消息的窗口句柄
- // hNotifyMsg -自定义消息
- CPropertyGridItemStringButton (CString strCaption, LPCTSTR strValue = NULL, HWND hNotifyWnd = NULL, UINT nNotifyMsg = 0);
- // 构造函数,参数说明:
- // nID -属性ID
- // hNotifyWnd -接收自定义消息的窗口句柄
- // hNotifyMsg -自定义消息
- CPropertyGridItemStringButton (UINT nID, LPCTSTR strValue = NULL, HWND hNotifyWnd = NULL, UINT nNotifyMsg = 0);
- virtual ~CPropertyGridItemStringButton();
- protected:
- // 当属性值由于用户输入而改变时,调用此函数
- //virtual void SetValue(CString strValue);
- //virtual BOOL OnDrawItemValue(CDC& dc, CRect rcValue);
- //virtual CRect GetValueRect();
- // 当用户点击按钮时,调用此虚函数
- virtual void OnInplaceButtonDown();
- // 当用户双击属性项时,调用此虚函数
- virtual void OnLButtonDblClk();
- HWND m_hNotifyWnd; // 接收自定义消息的窗口句柄
- UINT m_nNotifyMsg; // 自定义消息
- CString m_strTitle; // 字串内容;
- public:
- // 设置属性值:value-新的属性值
- void SetTitle(CString strValue);
- // 获取属性值
- double GetTitle();
- // 把一个字符串对象绑定到属性项
- void BindToString(CString* pBindString)
- {
- m_pBindString = pBindString;
- if (m_pBindString)
- SetValue(*m_pBindString);
- }
- };
|