正文

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

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


 

在CStageButton類的實(shí)現(xiàn)代碼中,設(shè)置當(dāng)鼠標(biāo)按下時(shí)觸發(fā)的云臺(tái)控制代碼和鼠標(biāo)抬起時(shí)停止對(duì)云臺(tái)的控制。代碼如下:

//當(dāng)按下鼠標(biāo)按鈕時(shí),根據(jù)按鈕的類型標(biāo)識(shí)調(diào)用不同的方法

void CStageButton::OnLButtonDown(UINT nFlags, CPoint point) 

{

switch(m_Type)

{

case ctUp:

{

((CCaptureDlg*)GetParent())->OnUp(); //控制云臺(tái)向上

break;

}

case ctDown:

{

((CCaptureDlg*)GetParent())->OnDown(); //控制云臺(tái)向下

break;

}

case ctLeft:

{

((CCaptureDlg*)GetParent())->OnLeft(); //控制云臺(tái)向左

break;

}

case ctRight:

{

((CCaptureDlg*)GetParent())->OnRight(); //控制云臺(tái)向右

break;

}

case ctInFoci:

{

((CCaptureDlg*)GetParent())->OnInFoci(); //設(shè)置聚焦減

break;

}

case ctReFoci:

{

((CCaptureDlg*)GetParent())->OnReFoci(); //設(shè)置聚焦增

break;

}

case ctInLen:

{

((CCaptureDlg*)GetParent())->OnInLen(); //設(shè)置對(duì)焦減

break;

}

case ctReLen:

{

((CCaptureDlg*)GetParent())->OnReLen(); //設(shè)置對(duì)焦增

break;

}

case ctInAperture:

{

((CCaptureDlg*)GetParent())->OnInAperture(); //設(shè)置光圈減

break;

}

case ctReAperture:

{

((CCaptureDlg*)GetParent())->OnReAperture(); //設(shè)置光圈增

break;

}

case ctInBrush:

{

((CCaptureDlg*)GetParent())->OnInBrush(); //設(shè)置畫筆減

break;

}

case ctReBrush:

{

((CCaptureDlg*)GetParent())->OnReBrush(); //設(shè)置畫筆增

break;

}

default:

{

break;

}

}

CButton::OnLButtonDown(nFlags, point);

}

//當(dāng)釋放鼠標(biāo)按鈕時(shí)停止對(duì)云臺(tái)的控制

void CStageButton::OnLButtonUp(UINT nFlags, CPoint point) 

{

((CCaptureDlg*)GetParent())->OnReset();

CButton::OnLButtonUp(nFlags, point);

}


上一章目錄下一章

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