void CDemoDlg::OnLButtonDblClk(UINT nFlags, CPoint point)
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
ProcessMouseMessage(_T("双击"),_T("左键"),point);
CDialogEx::OnLButtonDblClk(nFlags, point);
}
void CDemoDlg::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
ProcessMouseMessage(_T("按下"),_T("左键"),point);
CDialogEx::OnLButtonDown(nFlags, point);
}
void CDemoDlg::ProcessMouseMessage(LPCTSTR lpszEvent, LPCTSTR lpszKey, const CPoint &point)
{
CString strMsg;
strMsg.Format(_T("鼠标%s%s了,鼠标的坐标: %d, %d"),lpszKey,lpszEvent,point.x,point.y);
SetDlgItemText(IDC_MOUSE_MESSAGE,strMsg);
}
void CDemoDlg::OnLButtonUp(UINT nFlags, CPoint point)
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
ProcessMouseMessage(_T("松开"),_T("左键"),point);
CDialogEx::OnLButtonUp(nFlags, point);
}
void CDemoDlg::OnRButtonDblClk(UINT nFlags, CPoint point)
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
ProcessMouseMessage(_T("双击"),_T("右键"),point);
CDialogEx::OnRButtonDblClk(nFlags, point);
}
void CDemoDlg::OnRButtonDown(UINT nFlags, CPoint point)
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
ProcessMouseMessage(_T("按下"),_T("右键"),point);
CDialogEx::OnRButtonDown(nFlags, point);
}
void CDemoDlg::OnRButtonUp(UINT nFlags, CPoint point)
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
ProcessMouseMessage(_T("松开"),_T("右键"),point);
CDialogEx::OnRButtonUp(nFlags, point);
}
void CDemoDlg::OnMButtonDblClk(UINT nFlags, CPoint point)
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
ProcessMouseMessage(_T("双击"),_T("中键"),point);
CDialogEx::OnMButtonDblClk(nFlags, point);
}
void CDemoDlg::OnMButtonDown(UINT nFlags, CPoint point)
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
ProcessMouseMessage(_T("按下"),_T("中键"),point);
CDialogEx::OnMButtonDown(nFlags, point);
}
void CDemoDlg::OnMButtonUp(UINT nFlags, CPoint point)
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
ProcessMouseMessage(_T("松开"),_T("中键"),point);
CDialogEx::OnMButtonUp(nFlags, point);
}
BOOL CDemoDlg::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt)
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
if(zDelta <0)
{
ProcessMouseMessage(_T("向下滚动"),_T("滚轮"),pt);
}
else
{
ProcessMouseMessage(_T("向上滚动"),_T("滚轮"),pt);
}
return CDialogEx::OnMouseWheel(nFlags, zDelta, pt);
}