| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- #pragma once
- /////////////////////////////////////////////////////////////////////////////
- // CInplaceDegreeEdit
- /////////////////////////////////////////////////////////////////////////////
- #include "MaskEdit.h"
- class CPropertyGridExtItemDegree; // 前向引用
- class CInplaceDegreeEdit : public CDegreeEdit
- {
- public:
- // 构造函数:
- // nSecondPrecision-秒的小数部分的位数,范围0-3
- CInplaceDegreeEdit(int nSecondPrecision);
- virtual ~CInplaceDegreeEdit();
- void SetValue(CString strValue);
- void Create(CPropertyGridExtItemDegree* pItem, CRect rect);
- void DestroyItem();
- protected:
- CString m_strValue;
- CBrush m_brBack;
- COLORREF m_clrBack;
- CWnd* m_pGrid;
- CPropertyGridExtItemDegree* m_pItem;
- protected:
- //{{AFX_VIRTUAL(CInplaceDegreeEdit)
- //}}AFX_VIRTUAL
- virtual BOOL SelectConstraint(int nDirection, BOOL bCircle);
- //{{AFX_MSG(CInplaceDegreeEdit)
- 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 CPropertyGridExtItemDegree;
- };
- /////////////////////////////////////////////////////////////////////////////
- // CPropertyGridExtItemDegree 该属性表项以度分秒方式输入和显示度,使用了格式化输入控件
- /////////////////////////////////////////////////////////////////////////////
- class CPropertyGridExtItemDegree : public CPropertyGridItem
- {
- public:
- // 构造函数:
- // strCaption -属性名称
- // fDegree -初始属性值,单位:度
- // nSecondPrecision-秒的小数部分的位数,范围0-3
- CPropertyGridExtItemDegree(CString strCaption, double fDegree = 0, int nSecondPrecision = 2);
- // 构造函数:
- // nID -属性ID
- // fDegree -初始属性值,单位:度
- // nSecondPrecision-秒的小数部分的位数,范围0-3
- CPropertyGridExtItemDegree(UINT nID, double fDegree = 0, int nSecondPrecision = 2);
-
- virtual ~CPropertyGridExtItemDegree();
- // 设置属性值:
- // fDegree-新的属性值,单位:度
- void SetDegree(double fDegree);
- // 获取属性值,返回值单位:度
- double GetDegree();
- // 把一个浮点变量绑定到属性项
- void BindToDegree(double* pBindDegree);
- protected:
- double m_fDegree; // 属性值,单位:度
- int m_nSecondPrecision; // 秒的小数部分的位数,范围0-3
- double* m_pBindDegree; // 绑定到属性项的浮点变量
- // 当属性值由于用户输入而改变时,调用此函数
- virtual void SetValue(CString strValue);
- virtual void OnSelect();
- virtual void OnValidateEdit();
- virtual void SetEditText(CString str);
- virtual BOOL OnChar(UINT nChar);
- virtual void OnLButtonDblClk();
- CInplaceDegreeEdit m_wndDegreeEdit;
- friend class CInplaceDegreeEdit;
- };
|