本人初学阶段还望赐教!1 对话框中置两个按钮OPEN和CLOSE,添加基于CButton的派生类CBtn的两个按钮的成员变量m_btn1和m_btn2。2 在CBtn类中添加LButtonDown,OnLButtonDblClk,OnMouseMove的消息响应。3 单击按钮后void CBtn::OnLButtonDown(UINT nFlags, CPoint point)响应,为什么再单击对话框的其它地方它仍然响应?如果开始先单击对话框的其他地方的话它不会响应。4 为什么MouseMove和LButtonDblClk的消息响应函数不会出现这种情况?void CBtn::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
// MessageBox("OnLButtonDown"); //测试
CButton::OnLButtonDown(nFlags, point);
}void CBtn::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
// MessageBox("OnMouseMove"); //测试
CButton::OnMouseMove(nFlags, point);
}void CBtn::OnLButtonDblClk(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
MessageBox("OnLButtonDblClk"); //测试
CButton::OnLButtonDblClk(nFlags, point);
}
{
// TODO: Add your message handler code here and/or call default
// MessageBox("OnLButtonDown"); //测试
CButton::OnLButtonDown(nFlags, point);
}void CBtn::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
// MessageBox("OnMouseMove"); //测试
CButton::OnMouseMove(nFlags, point);
}void CBtn::OnLButtonDblClk(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
MessageBox("OnLButtonDblClk"); //测试
CButton::OnLButtonDblClk(nFlags, point);
}
{
// TODO: Add your message handler code here and/or call default
MessageBox("OnLButtonDown"); //测试
// 加上
PostMessage(WM_CANCELMODE);CButton::OnLButtonDown(nFlags, point);
}