正文

主窗體設(shè)計(jì)(23)

Visual C++項(xiàng)目開(kāi)發(fā)案例全程實(shí)錄(第2版) 作者:明日科技


 

從CButton類派生一個(gè)子類CStageButton,目的是在按下按鈕時(shí)不停地控制云臺(tái),在釋放按鈕時(shí)停止對(duì)云臺(tái)的控制。CStageButton類聲明代碼如下:

//按鈕控制類型:上、下、左、右、自動(dòng)、焦聚減、焦聚增、對(duì)焦減、對(duì)焦增、光圈減、光圈增、雨刷減、雨刷增

enum  ControlType {ctUp,ctDown,ctLeft,ctRight,ctAuto,ctReFoci,

      ctInFoci,ctReLen,ctInLen,ctReAperture,ctInAperture,ctReBrush,ctInBrush};

class CStageButton : public CButton

{

public:

CStageButton(); //構(gòu)造函數(shù)

public:

ControlType m_Type; //控制按鈕

public:

virtual ~CStageButton(); //析構(gòu)函數(shù)

protected:

//{{AFX_MSG(CStageButton)

afx_msg void OnLButtonDown(UINT nFlags, CPoint point); //鼠標(biāo)左鍵按下

afx_msg void OnLButtonUp(UINT nFlags, CPoint point);   //鼠標(biāo)左鍵抬起

//}}AFX_MSG

DECLARE_MESSAGE_MAP()

};


上一章目錄下一章

Copyright ? 讀書(shū)網(wǎng) www.afriseller.com 2005-2020, All Rights Reserved.
鄂ICP備15019699號(hào) 鄂公網(wǎng)安備 42010302001612號(hào)