When I'm loading a child form in MDIparent
the control box also appears. I want to remove the control box and the border of child form. Also I'm writing code as
private void Form_mainMenu_Load(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Maximized;
this.ControlBox = false;
this.FormBorderStyle = FormBorderStyle.None;
}
If you really want to customize the appearance of title bar of mdiChild Window, it seems you need handle painting of non-client areas of child window by handling WM_NCPAINT
message. Also you need to handle messages like WM_SETCURSOR
, WM_MOUSEMOVE
, WM_NCLBUTTONDOWN
, ... .
As a workaround you can use a panel instead of mdiParent.
IsMdiContainer
. Dock
property to fill. Here is sample code:
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();
Using such method you can control every aspect of your hand made mdi window. For example you can use a Menu to show list of open windows and a toolstrip to close windows.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.