5

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?

Jason Plank
  • 2,322
  • 4
  • 29
  • 39
WorldIntruder
  • 191
  • 1
  • 10
  • 1
    By chance, have you made any progress on this? It's bothering me too, and I was considering opening a question with a bounty on it to get it answered. If you're still without an answer, I'll open a new bounty question. – SqlRyan Jun 22 '09 at 22:15

3 Answers3

8

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.

Jason Plank
  • 2,322
  • 4
  • 29
  • 39
WorldIntruder
  • 191
  • 1
  • 10
0

This conversation from years ago suggests that there's no way to do it, and he ended up with User Controls on the main form, instead of actually using an MDI interface:

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

Every other thread I can find online is either abandoned with no answers or a dead-end. I can't believe this functionality if so cumbersome and not something natively available.

SqlRyan
  • 30,939
  • 32
  • 109
  • 190
0

There is an easier way than adding the code to the Load event for every form. Just place this code in the MdiParent form and substitute MenuStrip for the actual name you're using 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
Peter O.
  • 28,965
  • 14
  • 72
  • 87
C.Corvax
  • 43
  • 8