判断鼠标的点击区域

void CMYDlgDlg::OnMouseMove(UINT nFlags, CPoint point) 
{
	CDC *pDC = m_Close.GetDC();
	CRect rect;
	m_Close.GetClientRect(&rect);//要获取位置的控件ID
	
	if(rect.PtInRect(point))
	{
		MessageBox("鼠标位于按钮内!"); 
	}

	CDialog::OnMouseMove(nFlags, point);
}

你可能感兴趣的:(判断鼠标的点击区域)