Removing the default MDI menu in the form of an MDI container while maximizing the MDI child

I am working on a .NET C # application that has a main form, which is an MDI container. When the user maximizes the MDI child, Windows draws a control bar right below the header of the Form container, which has a child icon and system buttons on the right. Basically, I need to hide this strip and use a user control to provide the same functionality.

Is there a way to prevent Windows from using this MDI strip?

+4
source share
3 answers

Actually, I found a simple and interesting way to remove this thing from my form by assigning the MainMenuStrip property of the form using the dummy MenuStrip control (without putting it in the form's control collection):

private void OnForm_Load(object sender, EventArgs e) { this.MainMenuStrip = new MenuStrip(); } 

This prevents the MDI header from coloring by default, as the form delegates its default functionality, if any. Because the MenuStrip control is not in the collection of form controls, it is also not displayed, and therefore it simply serves as a dummy menu used to hide the hideous MDI menu when the child is maximized.

+8
source

This talk from a few years ago suggests that there is no way to do this, and he ended up with User Controls in the main form, instead of actually using the MDI interface:

http://answers.google.com/answers/threadview/id/135136.html

Every other thread that I can find on the network is either left unanswered or at a standstill. I can not believe in this functionality if it is bulky, and not something originally available.

0
source

There is an easier way than adding code to the load event for each form. Just put this code in the MdiParent form and replace MenuStrip with the actual name that you use for your menustrip control.

 Private Sub MenuStrip_ItemAdded(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolStripItemEventArgs) Handles MenuStrip.ItemAdded Dim s As New String(e.Item.GetType().ToString()) If s = "System.Windows.Forms.MdiControlStrip+SystemMenuItem" Then e.Item.Visible = False End If End Sub 
0
source

Source: https://habr.com/ru/post/1286054/


All Articles