Making an MDI form, i wish to remove the top bar on all child forms. Working on Visual studio and c#. Any idea how? Im clueless.

Here the properies of the child form:
Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None
Me.WindowState = FormWindowState.Normal
Me.MinimizeBox = False
Me.MaximizeBox = False
Me.ControlBox = False
Me.ShowIcon = False
Me.ShowInTaskbar = False
Me.Dock = DockStyle.Fill
As mentioned in this answer, you can add a MenuStrip control to your MDI parent form, set its Visible property to false, and you should be good to go. The MDI child forms won't have a title bar displayed as long as they are maximized.
MdiParent Property of the child form.FormBorderStyle property of the child form to FormBorderStyle.None.Dock property of the child form to DockStyle.Fill. Note: This must come after setting the MdiParent or else it won't work.WindowState, ControlBox, etc.). Just maintain the order of the steps above.Here's an example:
private void OpenAndDockMdiChild()
{
Form2 childForm = new Form2();
childForm.MdiParent = this; // This must come **before** setting
// the `Dock` property.
childForm.FormBorderStyle = FormBorderStyle.None;
childForm.Dock = DockStyle.Fill;
childForm.Show();
}
private void Form1_Load(object sender, EventArgs e)
{
OpenAndDockMdiChild();
}
Result:
Hope that helps.
* Tested with .NET 4.5.2 on both Windows 7 and Windows 10.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With