根据鼠标起点和落点判断鼠标操作
2016-03-18 13:53
656 查看
1.需要声明对话框的消息解析函数
2.对鼠标按键进行判断,当前以鼠标左键作为例子:
virtual BOOL PreTranslateMessage(MSG* pMsg);
2.对鼠标按键进行判断,当前以鼠标左键作为例子:
BOOL CDlg::PreTranslateMessage(MSG* pMsg) { // TODO: 在此添加专用代码和/或调用基类 if(WM_LBUTTONDOWN== pMsg->message) { if (m_bLeftButtonDown==FALSE) { int xPos = LOWORD(pMsg->lParam); int yPos = HIWORD(pMsg->lParam); m_LastPoint.x=xPos; m_LastPoint.y=yPos; ::ClientToScreen(pMsg->hwnd,&m_LastPoint); m_bLeftButtonDown=TRUE; } }else if (WM_LBUTTONUP==pMsg->message) { if (m_bLeftButtonDown) { int xPos = LOWORD(pMsg->lParam); int yPos = HIWORD(pMsg->lParam); m_CrrentPoint.x=xPos; m_CrrentPoint.y=yPos; ::ClientToScreen(pMsg->hwnd,&m_CrrentPoint); m_bLeftButtonDown=FALSE; DoYouThings();//处理你想处理的动作 } } return CDialogEx::PreTranslateMessage(pMsg); }
相关文章推荐
- MapReduce开发技巧
- 关于css3中transform的理解(只是改变状态未改变其真正的属性)
- LearnMVC5-AddController
- 2821: 作诗(Poetize)
- jetty和jboss和linux的关联
- spring和ssh和udp的关联
- tcp和com和groovy的关联
- ant和plsql和excel的关联
- oracle和com和javascript的关联
- android ListView嵌入EditText焦点和值错误问题
- android 一些基础用法
- 进入cmd 输入dir 列出所有内容。
- C# 把DataGridView控件数据,转成DataTable
- Thinkphp页数显示
- Android项目:手机安全卫士(14)—— 短信备份
- QQ拼音输入法 该到放弃的时候了
- HTTP所有状态代码及其定义
- PHP扩展开发入门
- 实验三5 NIO
- apache和aspx和javascript的关联