從CButton類派生一個子類CStageButton,目的是在按下按鈕時不停地控制云臺,在釋放按鈕時停止對云臺的控制。CStageButton類聲明代碼如下:
//按鈕控制類型:上、下、左、右、自動、焦聚減、焦聚增、對焦減、對焦增、光圈減、光圈增、雨刷減、雨刷增
enum ControlType {ctUp,ctDown,ctLeft,ctRight,ctAuto,ctReFoci,
ctInFoci,ctReLen,ctInLen,ctReAperture,ctInAperture,ctReBrush,ctInBrush};
class CStageButton : public CButton
{
public:
CStageButton(); //構造函數(shù)
public:
ControlType m_Type; //控制按鈕
public:
virtual ~CStageButton(); //析構函數(shù)
protected:
//{{AFX_MSG(CStageButton)
afx_msg void OnLButtonDown(UINT nFlags, CPoint point); //鼠標左鍵按下
afx_msg void OnLButtonUp(UINT nFlags, CPoint point); //鼠標左鍵抬起
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};