两种方法点击客户区,移动对话框

1.

void CMoveDlg::OnLButtonDown(UINT nFlags, CPoint point) { // TODO: 在此添加消息处理程序代码和/或调用默认值 PostMessage(WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM(point.x,point.y)); CDialog::OnLButtonDown(nFlags, point); }

2.

LRESULT CMoveDlg::OnNcHitTest(CPoint point) { // TODO: 在此添加消息处理程序代码和/或调用默认值 ScreenToClient(&point); CRect rc; GetClientRect(&rc); if(rc.PtInRect(point)) { return HTCAPTION; } return CDialog::OnNcHitTest(point); }

你可能感兴趣的:(两种方法点击客户区,移动对话框)