从CButton类派生一个子类CStageButton,目的是在按下按钮时不停地控制云台,在释放按钮时停止对云台的控制。CStageButton类声明代码如下:
//按钮控制类型:上、下、左、右、自动、焦聚减、焦聚增、对焦减、对焦增、光圈减、光圈增、雨刷减、雨刷增
enum ControlType {ctUp,ctDown,ctLeft,ctRight,ctAuto,ctReFoci,
ctInFoci,ctReLen,ctInLen,ctReAperture,ctInAperture,ctReBrush,ctInBrush};
class CStageButton : public CButton
{
public:
CStageButton(); //构造函数
public:
ControlType m_Type; //控制按钮
public:
virtual ~CStageButton(); //析构函数
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()
};