wyMeterCtl.h
资源名称:组态王6.5源代码.rar [点击查看]
上传用户:seaboy_04
上传日期:2013-02-24
资源大小:284k
文件大小:3k
源码类别:
其他行业
开发平台:
Visual C++
- #if !defined(AFX_WYMETERCTL_H__15491A73_5B63_11D5_ADD3_001088AB5D33__INCLUDED_)
- #define AFX_WYMETERCTL_H__15491A73_5B63_11D5_ADD3_001088AB5D33__INCLUDED_
- #if _MSC_VER > 1000
- #pragma once
- #endif // _MSC_VER > 1000
- // wyMeterCtl.h : Declaration of the CwyMeterCtrl ActiveX Control class.
- /////////////////////////////////////////////////////////////////////////////
- // CwyMeterCtrl : See wyMeterCtl.cpp for implementation.
- #ifndef ROUND
- #define ROUND(x) (int)((x) + 0.5 - (double)((x) < 0))
- #endif
- #define BOUNDARY_POINTS 48
- class CwyMeterCtrl : public COleControl
- {
- DECLARE_DYNCREATE(CwyMeterCtrl)
- // Constructor
- public:
- CwyMeterCtrl();
- // Overrides
- // ClassWizard generated virtual function overrides
- //{{AFX_VIRTUAL(CwyMeterCtrl)
- public:
- virtual void OnDraw(CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid);
- virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
- virtual void DoPropExchange(CPropExchange* pPX);
- virtual void OnResetState();
- virtual void Serialize(CArchive& ar);
- //}}AFX_VIRTUAL
- // Implementation
- protected:
- void UpdateNeedle(double dValue) ;
- void DrawNeedle(CDC *pDC) ;
- void DrawValue(CDC *pDC) ;
- void DrawMeterBackground(CDC *pDC, const CRect &rect) ;
- int m_nValueFontHeight ;
- int m_nValueFontWidth ;
- COLORREF m_colorHighlight ;
- COLORREF m_colorShadow ;
- CRect m_rectValue ;
- CPoint m_pointBoundary[BOUNDARY_POINTS] ;
- CRgn m_rgnBoundary ;
- int m_nTopRadius ;
- double m_dLeftAngleRad ;
- double m_dRightAngleRad ;
- int m_nBottomCX ;
- int m_nBottomCY ;
- int m_nBottomRadius ;
- COLORREF m_colorWindow ;
- int m_nValueBaseline ;
- int m_nValueCenter ;
- COLORREF m_colorButton ;
- COLORREF m_colorText ;
- CFont m_fontValue ;
- CBitmap *m_pBitmapOldBackground ;
- CBitmap m_bitmapBackground;
- CDC m_dcBackground;
- CRect m_rectCtrl;
- ~CwyMeterCtrl();
- DECLARE_OLECREATE_EX(CwyMeterCtrl) // Class factory and guid
- DECLARE_OLETYPELIB(CwyMeterCtrl) // GetTypeInfo
- DECLARE_PROPPAGEIDS(CwyMeterCtrl) // Property page IDs
- DECLARE_OLECTLTYPE(CwyMeterCtrl) // Type name and misc status
- // Subclassed control support
- BOOL IsSubclassedControl();
- LRESULT OnOcmCommand(WPARAM wParam, LPARAM lParam);
- // Message maps
- //{{AFX_MSG(CwyMeterCtrl)
- afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
- afx_msg void OnDestroy();
- afx_msg void OnTimer(UINT nIDEvent);
- //}}AFX_MSG
- DECLARE_MESSAGE_MAP()
- // Dispatch maps
- //{{AFX_DISPATCH(CwyMeterCtrl)
- double m_dMaxValue; //最大量程
- afx_msg void OnDMaxValueChanged();
- double m_dMinValue; //最小量程
- afx_msg void OnDMinValueChanged();
- double m_dCurrentValue; //当前值
- afx_msg void OnDCurrentValueChanged();
- short m_nScaleDecimals; //标尺精度
- afx_msg void OnNScaleDecimalsChanged();
- short m_nValueDecimals; //数值精度
- afx_msg void OnNValueDecimalsChanged();
- OLE_COLOR m_colorNeedle; //指针颜色
- afx_msg void OnColorNeedleChanged();
- CString m_strUnits; //计量单位
- afx_msg void OnStrUnitsChanged();
- afx_msg void SetCurrentValue(double val);
- //}}AFX_DISPATCH
- DECLARE_DISPATCH_MAP()
- afx_msg void AboutBox();
- // Event maps
- //{{AFX_EVENT(CwyMeterCtrl)
- //}}AFX_EVENT
- DECLARE_EVENT_MAP()
- // Dispatch and event IDs
- public:
- enum {
- //{{AFX_DISP_ID(CwyMeterCtrl)
- dispidSetCurrentValue = 8L,
- //}}AFX_DISP_ID
- };
- };
- //{{AFX_INSERT_LOCATION}}
- // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
- #endif // !defined(AFX_WYMETERCTL_H__15491A73_5B63_11D5_ADD3_001088AB5D33__INCLUDED)