当我在MDIparent
中加载子表单时,也会出现控制框。我想删除控制框和子窗体的边框。
我也在编写代码
private void Form_mainMenu_Load(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Maximized;
this.ControlBox = false;
this.FormBorderStyle = FormBorderStyle.None;
}
答案 0 :(得分:4)
如果你真的想自定义mdiChild窗口标题栏的外观,你似乎需要通过处理WM_NCPAINT
消息来处理子窗口的非客户区域的绘制。
您还需要处理WM_SETCURSOR
,WM_MOUSEMOVE
,WM_NCLBUTTONDOWN
,...等消息。
作为一种解决方法,您可以使用面板而不是mdiParent。
IsMdiContainer
。Dock
属性设置为填充。以下是示例代码:
var f = new ChildForm();
f.TopLevel = false;
f.ControlBox = false;
f.Dock = DockStyle.Fill;
f.BorderStyle = System.Windows.Forms.BorderStyle.None;
/*I assume this code is in your ParentForm and so 'this' points to ParentForm that contains ContainerPanel*/
this.ContainerPanel.Controls.Add(f);
f.Show();
使用这种方法可以控制手工制作的mdi窗口的各个方面。例如,您可以使用菜单显示打开的窗口列表和工具条来关闭窗口。