窗口拖动

 

定义函数:

afx_msg LRESULT OnNcHitTest(CPoint pt);

消息映射:

BEGIN_MESSAGE_MAP(CMy57projectDlg, CDialog)
    ON_WM_NCHITTEST()
END_MESSAGE_MAP()

函数实现:

LRESULT CMy57projectDlg::OnNcHitTest(CPoint pt)
{
CRect rc;
GetClientRect(&rc);
ClientToScreen(&rc);
return rc.PtInRect(pt) ? HTCAPTION : CDialog::OnNcHitTest(pt);
}

 

你可能感兴趣的:(窗口拖动)