📄 switchctl.h
字号:
#if !defined(AFX_SWITCHCTL_H__F1B4FDBA_81E0_4260_9060_1C2FC8F8325A__INCLUDED_)
#define AFX_SWITCHCTL_H__F1B4FDBA_81E0_4260_9060_1C2FC8F8325A__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// SwitchCtl.h : Declaration of the CSwitchCtrl ActiveX Control class.
/////////////////////////////////////////////////////////////////////////////
// CSwitchCtrl : See SwitchCtl.cpp for implementation.
class CSwitchCtrl : public COleControl
{
DECLARE_DYNCREATE(CSwitchCtrl)
// Constructor
public:
CSwitchCtrl();
void DrawSwitch1(CDC* pdc, const CRect& rc,short iSwitchType);
void DrawSwitch2(CDC* pdc, const CRect& rc,short iSwitchType);
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CSwitchCtrl)
public:
virtual void OnDraw(CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid);
virtual void DoPropExchange(CPropExchange* pPX);
virtual void OnResetState();
virtual BOOL OnSetExtent(LPSIZEL lpSizeL);
protected:
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
//}}AFX_VIRTUAL
// Implementation
protected:
short m_iSwitchType;
// BOOL m_bVerticalLine; //control to draw the switch's vertical line
BOOL m_bOnOff; //false:switch is off, true:switch is on
OLE_COLOR m_fillColor;
short m_lineSize;
BOOL m_bImageHollow;
OLE_COLOR m_foreColor;
OLE_COLOR m_backColor;
~CSwitchCtrl();
DECLARE_OLECREATE_EX(CSwitchCtrl) // Class factory and guid
DECLARE_OLETYPELIB(CSwitchCtrl) // GetTypeInfo
DECLARE_PROPPAGEIDS(CSwitchCtrl) // Property page IDs
DECLARE_OLECTLTYPE(CSwitchCtrl) // Type name and misc status
// Message maps
//{{AFX_MSG(CSwitchCtrl)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg LRESULT OnMySetExtent(WPARAM wParam, LPARAM lParam);
afx_msg LRESULT OnMyMessage101(WPARAM wParam, LPARAM lParam);
afx_msg LRESULT OnMyMessage102(WPARAM wParam, LPARAM lParam);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
// Dispatch maps
//{{AFX_DISPATCH(CSwitchCtrl)
afx_msg OLE_COLOR GetBackColor();
afx_msg void SetBackColor(OLE_COLOR nNewValue);
afx_msg OLE_COLOR GetForeColor();
afx_msg void SetForeColor(OLE_COLOR nNewValue);
afx_msg short GetLineSize();
afx_msg void SetLineSize(short nNewValue);
afx_msg BOOL GetImageHollow();
afx_msg void SetImageHollow(BOOL bNewValue);
afx_msg OLE_COLOR GetFillColor();
afx_msg void SetFillColor(OLE_COLOR nNewValue);
afx_msg BOOL GetOnOff();
afx_msg void SetOnOff(BOOL bNewValue);
afx_msg short GetSwitchType();
afx_msg void SetSwitchType(short nNewValue);
//}}AFX_DISPATCH
DECLARE_DISPATCH_MAP()
// Event maps
//{{AFX_EVENT(CSwitchCtrl)
//}}AFX_EVENT
DECLARE_EVENT_MAP()
// Dispatch and event IDs
public:
enum {
//{{AFX_DISP_ID(CSwitchCtrl)
dispidBackColor = 1L,
dispidForeColor = 2L,
dispidLineSize = 3L,
dispidImageHollow = 4L,
dispidFillColor = 5L,
dispidOnOff = 6L,
dispidSwitchType = 7L,
//}}AFX_DISP_ID
};
private:
short m_iControlHeight; //control's height
short m_iControlWidth; //control's width
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_SWITCHCTL_H__F1B4FDBA_81E0_4260_9060_1C2FC8F8325A__INCLUDED)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -