我是在重载的CMyStatic类中使用的LButtonDown(),LButtonUp(),MouseMove()这几个函数,测试发现鼠标单击时没有响应??在视图里面这几个函数是可以响应的,所以我怀疑是不是这里出了问题呢?谢谢void CMyStatic::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
m_mousedownx=point.x;
m_mousedowny=point.y;
Invalidate();//加上
CStatic::OnLButtonDown(nFlags, point);
}void CMyStatic::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
m_mousemovex=point.x;
m_mousemovey=point.y;
m_addx=m_mousemovex-m_mousedownx;
m_addy=m_mousemovey-m_mousedowny;
Invalidate();//加上
CStatic::OnMouseMove(nFlags, point);
}OnPaint()里的程序:
dc.StretchBlt(0 ,0 ,rect.Width()-m_addx,rect.Height()-m_addy,&MemDC,0,0,rect.Width(),rect.Height() ,SRCCOPY);
{
// TODO: Add your message handler code here and/or call default
m_mousedownx=point.x;
m_mousedowny=point.y;
Invalidate();//加上
CStatic::OnLButtonDown(nFlags, point);
}void CMyStatic::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
m_mousemovex=point.x;
m_mousemovey=point.y;
m_addx=m_mousemovex-m_mousedownx;
m_addy=m_mousemovey-m_mousedowny;
Invalidate();//加上
CStatic::OnMouseMove(nFlags, point);
}OnPaint()里的程序:
dc.StretchBlt(0 ,0 ,rect.Width()-m_addx,rect.Height()-m_addy,&MemDC,0,0,rect.Width(),rect.Height() ,SRCCOPY);
解决方案 »
- 通过WM_COPYDATA向一个单文档的程序发送数据时,窗口的名字应该写什么?
- 请问高手,如果拦截TCP连接请求并让其转向?
- 安装不了vc
- 高手帮忙了。(内存问题)
- 急!!vc编辑环境里,如何使用搜索功能中的“正则表达式”?
- 请问能否判断用户是否有鼠标操作?????不是在自己的应用程序上,而是在系统是。
- 请教DOM查询XML的两个小问题,100分
- %%%****** 最最简单的入门问题,马上给分!!!!!!!!
- 哪儿有TeeChart-Pro Activex 5正版(解密版)控件下载?
- 轻松直播世界杯---《宽带网吧影视通》
- windows程序设置背景色问题
- 本人初学vc,请问各位,vs2008如何编译非托管vc程序啊?
把所有的CStatic替换成CWnd
这应该是比较简单的-_-||
我常这么干:P
ON_WM_MOUSEMOVE()
有么?
BEGIN_MESSAGE_MAP(CMyStatic, CWnd)
//{{AFX_MSG_MAP(CMyStatic)
ON_WM_PAINT()
ON_WM_ERASEBKGND()
ON_WM_LBUTTONDOWN()
ON_WM_MOUSEMOVE()
ON_WM_LBUTTONUP()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
那有可能是鼠标消息被其他窗口截获了,传不到这里...
或者是被主窗口PreTranslateMessage截获...
程序中还有其它窗口吗?
在视图中我还用到了一个鼠标双击的命令,当鼠标双击击某一个控件时使得该控件能够放大,放大之后能够查看图像
光看这段代码就知道即使楼主的程序能画出图像,只要鼠标在移动,CPU占用率肯定100%