I am working on a .NET C# application that has a main Form which is MDI container. When the user maximizes a MDI child, Windows draws a control strip right under the title bar of the container Form which has the Icon of the child and the system buttons on the right. Basically, what I need is hide this strip and use a custom control to provide the same functionality.
Is there any way to prevent Windows from drawing this MDI strip?
By default the MDI Child forms are added into the controls collection of the MdiClient in Parent form. So when set the ChildForm.
Because an MDI application can have many instances of the same child form, the procedure needs to know which form to use. To specify the correct form, use the ActiveMdiChild property, which returns the child form that has the focus or that was most recently active.
Actually, I found an easy and interesting way to remove this thing from my form by assigning the MainMenuStrip property of the Form with a dummy MenuStrip control (without putting it in the Controls collection of the Form):
private void OnForm_Load(object sender, EventArgs e)
{
this.MainMenuStrip = new MenuStrip();
}
This prevents the default MDI caption from being painted since the Form delegates its functionality to its default menu strip if any. Since the MenuStrip control is not in the Controls collection of the Form, it is also not visible and thus it just serves as a dummy menu used for hiding the nasty MDI menu when a child is maximized.
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