zl程序教程

您现在的位置是:首页 >  其它

当前栏目

对话框客户区实现拖动

实现 对话框 客户 拖动
2023-09-27 14:28:16 时间
参考文章:http://tech.sina.com.cn/s/2006-07-25/09051053460.shtml响应WM_NCHITTEST消息函数实现如下://////////////////// Non-client hit-test handler to move window by its client area.
参考文章:http://tech.sina.com.cn/s/2006-07-25/09051053460.shtml


响应WM_NCHITTEST消息


函数实现如下:


//////////////////
// Non-client hit-test handler to move window by its client area.
// If the user clicks anywhere on the client area, pretend its the
// caption. Windows does the rest!
UINT CMyDialog::OnNcHitTest(CPoint pt)
{
CRect rc;
GetClientRect( rc);
ClientToScreen( rc);
return rc.PtInRect(pt) ? HTCAPTION : CDialog::OnNcHitTest(pt);
}