把对话框边框风格设置成none然后添加 WM_NCHITTEST 消息响应函数测试鼠标位置 如果靠近边框的话返回对应的代码 HTBOTTOM In the lower-horizontal border of a resizable window (the user can click the mouse to resize the window vertically). HTBOTTOMLEFT In the lower-left corner of a border of a resizable window (the user can click the mouse to resize the window diagonally). HTBOTTOMRIGHT In the lower-right corner of a border of a resizable window (the user can click the mouse to resize the window diagonally). 基本上就是这样
处理WM_NCHITTEST的响应:The WM_NCHITTEST message is sent to a window when the cursor moves, or when a mouse button is pressed or released. If the mouse is not captured, the message is sent to the window beneath the cursor. Otherwise, the message is sent to the window that has captured the mouse.
如果靠近边框的话返回对应的代码
HTBOTTOM In the lower-horizontal border of a resizable window (the user can click the mouse to resize the window vertically).
HTBOTTOMLEFT In the lower-left corner of a border of a resizable window (the user can click the mouse to resize the window diagonally).
HTBOTTOMRIGHT In the lower-right corner of a border of a resizable window (the user can click the mouse to resize the window diagonally). 基本上就是这样
UINT CMoveTestDlg::OnNcHitTest(CPoint point)
{
// TODO: Add your message handler code here and/or call default
CRect rc;
CRect test;
GetClientRect(&rc);
test.left = rc.Width() - 5;
test.right = rc.right;
test.top = rc.Height() - 5;
test.bottom = rc.bottom;
ClientToScreen(&test);
ClientToScreen(&rc);
if(test.PtInRect(point))
{
return HTBOTTOMRIGHT;
}
else
{
return rc.PtInRect(point) ? HTCAPTION : CDialog::OnNcHitTest(point);
} return CDialog::OnNcHitTest(point);
}花了十分钟帮你调试出来的,实现窗口的移动和改变大小(右下角),其它的类似!^_^