classwizard里面添加WM_NCHITTEST消息的映射函数,修改如下即可 (提示默认的classwizard里面找不到该消息,在class info里面message filter里面选中window就有了)UINT CTempDlg::OnNcHitTest(CPoint point) { int ret = CDialog::OnNcHitTest(point);
//if语句的前两行是用来禁止改变大小的,最后一行是用来禁止移动的 if(HTTOP == ret || HTBOTTOM == ret || HTLEFT == ret || HTRIGHT == ret || HTBOTTOMLEFT == ret || HTBOTTOMRIGHT == ret || HTTOPLEFT == ret || HTTOPRIGHT == ret) return HTCLIENT;
return ret; }
Dialog程序用这个函数就可以了,详细地info可以查msdn了,呵呵! ModifyStyle(去掉的窗口类型,增加的窗口类型,窗口的位置和大小是否修改); ModifyStyle(WM_THICKFRAME,WM_DLGFRAME,0); This method modifies a window style. Styles to be added or removed can be combined by using the bitwise OR (|) operator. For more information about the available window styles, see CreateWindow.BOOL ModifyStyle( DWORD dwRemove, DWORD dwAdd, UINT nFlags = 0 ); Parameters dwRemove Specifies window styles to be removed during style modification. dwAdd Specifies window styles to be added during style modification. nFlags Flags to be passed to SetWindowPos, or zero if SetWindowPos should not be called. The default is zero. See the Res section for a list of preset flags.
你好!gaohl 1.报错:syntax error : '|' 2.HTTOP == ret ret ¦ ¦ HTBOTTOM == ret ¦ ¦ HTLEFT == ret ¦ ¦ HTRIGHT == ret 这个是禁止改变大小的吗? HTBOTTOMLEFT == ret ¦ ¦ HTBOTTOMRIGHT == ret ¦ ¦ HTTOPLEFT == ret ¦ ¦ HTTOPRIGHT == ret 这个是禁止移动的吗?
To na_he : ModifyStyle,我试了,不行!我这个对话框比较特殊,是作为改变通用对话框的模板对话框!
(提示默认的classwizard里面找不到该消息,在class info里面message filter里面选中window就有了)UINT CTempDlg::OnNcHitTest(CPoint point)
{
int ret = CDialog::OnNcHitTest(point);
//if语句的前两行是用来禁止改变大小的,最后一行是用来禁止移动的
if(HTTOP == ret || HTBOTTOM == ret || HTLEFT == ret || HTRIGHT == ret
|| HTBOTTOMLEFT == ret || HTBOTTOMRIGHT == ret || HTTOPLEFT == ret || HTTOPRIGHT == ret)
return HTCLIENT;
return ret;
}
ModifyStyle(去掉的窗口类型,增加的窗口类型,窗口的位置和大小是否修改); ModifyStyle(WM_THICKFRAME,WM_DLGFRAME,0); This method modifies a window style. Styles to be added or removed can be combined by using the bitwise OR (|) operator. For more information about the available window styles, see CreateWindow.BOOL ModifyStyle(
DWORD dwRemove,
DWORD dwAdd,
UINT nFlags = 0 );
Parameters
dwRemove
Specifies window styles to be removed during style modification.
dwAdd
Specifies window styles to be added during style modification.
nFlags
Flags to be passed to SetWindowPos, or zero if SetWindowPos should not be called. The default is zero. See the Res section for a list of preset flags.
1.报错:syntax error : '|'
2.HTTOP == ret ret ¦ ¦ HTBOTTOM == ret ¦ ¦ HTLEFT == ret ¦ ¦ HTRIGHT == ret 这个是禁止改变大小的吗?
HTBOTTOMLEFT == ret ¦ ¦ HTBOTTOMRIGHT == ret ¦ ¦ HTTOPLEFT == ret ¦ ¦ HTTOPRIGHT == ret 这个是禁止移动的吗?
ModifyStyle,我试了,不行!我这个对话框比较特殊,是作为改变通用对话框的模板对话框!