鼠标不点在对话框上 对话框关闭程序演示

注:

CWnd::MapWindowPoints

void MapWindowPoints( CWnd* pwndTo, LPRECT lpRect ) const;

void MapWindowPoints( CWnd* pwndTo, LPPOINT lpPoint, UINT nCount ) const;

参数说明

pwndTo

Identifies the window to which points are converted. If this parameter is NULL, the points are converted to screen coordinates.

标识了指定点要被转换到的窗口。如果这个参数为NULL,则该点被转换为屏幕坐标。

lpRect

Specifies the rectangle whose points are to be converted. The first version of this function is available only for Windows 3.1 and later.

指定了要转换的点所在的矩形。这个函数的第一个版本仅在Windows 3.1和以后的版本中有效。

lpPoint

A pointer to an array of POINT structures that contain the set of points to be converted.

执行POINT结构数组的指针,其中包含要转换的点。

nCount

Specifies the number of POINT structures in the array pointed to by lpPoint.

指定了lpPoint指向的数组中POINT结构的数目。

备注

Converts (maps) a set of points from the coordinate space of the CWnd to the coordinate space of another window.

这个函数将一系列点从CWnd的坐标空间转换(映射)到其它窗口的坐标空间

 

MK_LBUTTON :鼠标左键在移动的时候是按下的

 

给个例子:
void CDlgVolume::OnLButtonDown(UINT nFlags, CPoint point) 
{
// TODO: Add your message handler code here and/or call default
CRect rc;
GetClientRect(&rc);
// afxDump << rc << "/n";
if(!rc.PtInRect(point)) {// Because mouse is captured, so if mouse is out of dlg
ReleaseCapture();
m_SliderReturnValue=(-m_Slider.GetPos());
// useless ?
MapWindowPoints(GetParent(),&point,1);
EndDialog(0);
GetParent()->PostMessage(WM_LBUTTONDOWN,MK_LBUTTON,(LPARAM)((point.y<<16)+point.x));
//
afxDump << "1st /n";
return;
}
m_xOffset=point.x-rc.left;
m_yOffset=point.y-rc.top;
CDialog::OnLButtonDown(nFlags, point);
}

//鼠标不点在对话框上 对话框关闭程序演示

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值