I am fairly new to C# 2005. I am facing a strange problem in my first major project after migrating to C# 2005. I am using the concept of MDI and Child forms. My MDI form has the Menu bar on top as normal standard. My child form does not have any menu bar. But when I am displying the child form within the MDI form, a grey bar is being displayed between the title bar of the MDI form and above the Menu bar of the MDI form. It consists of an icon like picture at the left end and a disabled control box (minimize, restore/maximize and close buttons).

How do I get rid of this grey bar.

I am using the following code in my MDI for to display the child form.

frmChild1 Child1 = new frmChild1();
Child1.MdiParent = this;
Child1.Show();

Thank you.

Lalit Kumar Barik
India

Recommended Answers

All 11 Replies

Thats a standard bar at the top of any form. While you can remove it (havent tried removing specifically in c#), by ensuring your MDI child has no titlebar, its the best way for a user to tell which child they are addressing (as the text will help) it helps them move the children around if they arent maximized.

Set the FormBorderStyle property of the child form to none.

I am sorry, but setting FormBorderStyle = None did not worked.

Make sure you have turned off the controlbox, the min + max buttons and that the caption is nothing.

I am sorry, but setting FormBorderStyle = None did not worked.

Not the way you write it here. FormBorderStyle is an enumeration type. Do it like this:
Child1.FormBorderStyle = FormBorderStyle.None;
Child1.Show();

It worked with me, but I would advise not to use this unless you absolutely want to. See the first answer of LizR.

I think I was not very clear in my original post about my problem. In my project I have an MDI form which contains the Menu bar at the top. This form is displayed when the program is run. When the user chooses any Menu option another form is to be displayed. I want the Child form to be displayed within the MDI form container at max. size. I don't want to display the Title bar of the Child form. The Caption/Text of the Child form should be displayed in the Title bar of the MDI form itself enclosed by square braces. I don't want/need to move the Child form within the boundaries of the MDI form.

I have followed ALL suggestions given but unfortunately none worked for me. I am attaching the screenshots of my program to help the members in understanding my problem.

Waiting for further suggestions by members.

BTW, how do the other members code when they use the concept of MDI form and Child form as described my me here?? Any other solutions??

Thank you.

Lalit Kumar Barik
India

Old chinese proverb : "A picture says more than thousand words."
We keep you informed.

Sorry, but I can not produce the problem you have.
It works as you would it worked.
I use C# 2008, send you what I've tried.

Hi,

Even I had same problem and I have spent some amount of time to resolve the problem.

In order to fix the above issue, just change the MDI Child form's "ControlBox" property from TRUE ot FALSE.

Regards,
Sangmeshwar Patil

I am fairly new to C# 2005. I am facing a strange problem in my first major project after migrating to C# 2005. I am using the concept of MDI and Child forms. My MDI form has the Menu bar on top as normal standard. My child form does not have any menu bar. But when I am displying the child form within the MDI form, a grey bar is being displayed between the title bar of the MDI form and above the Menu bar of the MDI form. It consists of an icon like picture at the left end and a disabled control box (minimize, restore/maximize and close buttons).

How do I get rid of this grey bar.

I am using the following code in my MDI for to display the child form.

frmChild1 Child1 = new frmChild1();
Child1.MdiParent = this;
Child1.Show();

Thank you.

Lalit Kumar Barik
India

Since your code originaly is From VS 2003 you must probably add a line of code in the InitializeComponents method of your MainForm.

Add it below IsMDIContainer = true;

Add this code:

this.MainMenuStrip = 'the name of your mainmenu';

And you shouuld now be ok.

Arild
From Norway

I had same problem.I solved by setting mdi form's MainMenuStrip property to menustrip1(name of your menubar). Try changing this it would help.

Hetal

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.