展开全部
这里有个 反 例,参考。
二、禁止对话框改变大小
.h中:
...
afx_msg UINT OnNcHitTest(CPoint point);
...
.cpp中
BEGIN_MESSAGE_MAP(CXXXDlg, CDialog)
...
ON_WM_NCHITTEST()
...
END_MESSAGE_MAP()
UINT CXXXDlg::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 || HTCAPTION == ret)
return HTCLIENT;
return ret;
}
二、禁止对话框改变大小
.h中:
...
afx_msg UINT OnNcHitTest(CPoint point);
...
.cpp中
BEGIN_MESSAGE_MAP(CXXXDlg, CDialog)
...
ON_WM_NCHITTEST()
...
END_MESSAGE_MAP()
UINT CXXXDlg::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 || HTCAPTION == ret)
return HTCLIENT;
return ret;
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询