窗口中,如何拖动图像 MFC打开了一幅图像,如何用鼠标拖动该图像? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 响应WM_MOUSEMOVE消息,如果左键按下,根据鼠标位置重绘图像 图形放 CStatic 中 时 是:void CMyStatic::OnMouseMove(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call defaultstatic CPoint ptLast;// if(MK_LBUTTON==nFlags) { CRect rc; GetWindowRect(&rc); ScreenToClient(&rc); MapWindowPoints(GetParent(),&rc); MoveWindow(rc.left+(point.x-ptLast.x), rc.top+(point.y-ptLast.y), rc.Width(), rc.Height()); } else { ptLast=point; CStatic::OnMouseMove(nFlags, point); } Invalidate();} if(MK_LBUTTON==nFlags)如果 左键 按 下 else { ptLast=point; 保存 当前 位置 关于Duilib库移植到VC6中的问题 急,编译通不过。来帮帮忙! 摄像头不支持RGB24怎么办? DataGrid 更新时如何控制编辑框输入的内容 感谢CrazyAzreal帮忙写的TreeCtrl类 求救:文件修改保存问题? 高分请教!!程序Bug!!! 热心人帮我看看下面代码中数据库的DataSource应该怎么设定? 给100分先!!!!!!!!!!!!!!!!!!!!! 有关DLL中基类 派生类 以及静态变量 是否共享的问题 CScrollBar 类垂直滚动条上边箭头无效,怎么办? MFC的 combox 控件,
{
// TODO: Add your message handler code here and/or call default
static CPoint ptLast;
//
if(MK_LBUTTON==nFlags)
{
CRect rc;
GetWindowRect(&rc);
ScreenToClient(&rc);
MapWindowPoints(GetParent(),&rc);
MoveWindow(rc.left+(point.x-ptLast.x), rc.top+(point.y-ptLast.y), rc.Width(), rc.Height());
}
else
{
ptLast=point;
CStatic::OnMouseMove(nFlags, point);
}
Invalidate();
}
如果 左键 按 下
else
{
ptLast=point; 保存 当前 位置