现在的位置: 首页 > 综合 > 正文

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

2014年03月03日 ⁄ 综合 ⁄ 共 1388字 ⁄ 字号 评论关闭

注:

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);
}

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

抱歉!评论已关闭.