MFC隐藏对话框边框和可拖动

1、进入工程视图模式,修改对话框"Border"属性为"None"
在这里插入图片描述
此时已经去掉了边框。如果还想让对话框可拖动,则需要在工程视图模式的对话框界面右键,选择"类向导–>
消息–>WM_LBUTTONDOWN,重载函数OnLButtonDown
在这里插入图片描述

修改OnLButtonDown:

void CCTVPlugDlg::OnLButtonDown(UINT nFlags, CPoint point)
{
	// TODO: Add your message handler code here and/or call default

	CDialogEx::OnLButtonDown(nFlags, point);
	PostMessage(WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM(point.x, point.y));//使窗口可拖动
}

最后效果
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_23350817/article/details/103941248