| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- #pragma once
- /////////////////////////////////////////////////////////////////////////////
- // CInplaceMaskEdit 内置格式化输入控件
- /////////////////////////////////////////////////////////////////////////////
- #include "MaskEdit.h"
- class CPropertyGridExtItemMaskEdit; // 前向引用
- class CInplaceMaskEdit : public CMaskEdit
- {
- public:
- CInplaceMaskEdit();
- virtual ~CInplaceMaskEdit();
- void SetValue(CString strValue);
- void Create(CPropertyGridExtItemMaskEdit* pItem, CRect rect);
- void DestroyItem();
- protected:
- CString m_strValue;
- CBrush m_brBack;
- COLORREF m_clrBack;
- CWnd* m_pGrid;
- CPropertyGridExtItemMaskEdit* m_pItem;
- protected:
- //{{AFX_VIRTUAL(CInplaceMaskEdit)
- //}}AFX_VIRTUAL
- virtual BOOL SelectConstraint(int nDirection, BOOL bCircle);
- //{{AFX_MSG(CInplaceMaskEdit)
- afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor);
- afx_msg void OnEnKillfocus();
- afx_msg void OnEnSetfocus();
- afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
- afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
- afx_msg UINT OnGetDlgCode();
- void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
- //}}AFX_MSG
- DECLARE_MESSAGE_MAP()
- friend class CPropertyGridExtItemMaskEdit;
- };
- /////////////////////////////////////////////////////////////////////////////
- // CPropertyGridExtItemMaskEdit 该属性表项使用格式化输入控件
- /////////////////////////////////////////////////////////////////////////////
- class CPropertyGridExtItemMaskEdit : public CPropertyGridItem
- {
- public:
- // 构造函数:
- // strCaption -属性名称
- // lpszMask -格式化输入的掩码字符串,例如“00.00”
- // lpszLiteral-格式化输入的literal字符串,例如“__.__”
- // lpszDefault-格式化输入的缺省字符串
- // chPrompt -格式化输入的提示字符
- // 注意:参数lpszLiteral和lpszDefault中出现的提示字符必须跟参数
- // chPrompt保持一致。
- CPropertyGridExtItemMaskEdit(CString strCaption, LPCTSTR lpszMask, LPCTSTR lpszLiteral, LPCTSTR lpszDefault = NULL, TCHAR chPrompt = _T('_'));
- // 构造函数:
- // nID -属性ID
- // lpszMask -格式化输入的掩码字符串,例如“00.00”
- // lpszLiteral-格式化输入的literal字符串,例如“__.__”
- // lpszDefault-格式化输入的缺省字符串
- // chPrompt -格式化输入的提示字符
- // 注意:参数lpszLiteral和lpszDefault中出现的提示字符必须跟参数
- // chPrompt保持一致。
- CPropertyGridExtItemMaskEdit(UINT nID, LPCTSTR lpszMask, LPCTSTR lpszLiteral, LPCTSTR lpszDefault = NULL, TCHAR chPrompt = _T('_'));
-
- virtual ~CPropertyGridExtItemMaskEdit();
- protected:
- virtual void OnSelect();
- virtual void OnValidateEdit();
- virtual void SetEditText(CString str);
- virtual BOOL OnChar(UINT nChar);
- virtual void OnLButtonDblClk();
- CInplaceMaskEdit m_wndMaskEdit; // 内置格式化输入控件
- CString m_strEditMask;
- CString m_strLiteral;
- CString m_strDefault;
- TCHAR m_chPrompt;
- friend class CInplaceMaskEdit;
- };
|