Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MDI Childs title bar

Status
Not open for further replies.

sillysod

Technical User
Jan 6, 2004
300
GB
I have an application which uses an MDI interface, forms are loaded into the MDI form and a tab strip lists all open forms for the user to select between any open forms.

the user should never be able to change the MDI Children from been maximized (kinda like worksheets in Excel whereby they are always maximized on the form)

i have set the control box property to false aswell as the show min and show max options however when i maximize a form I get a title bar below the MDI Parents title with the 3 control buttons on it.

How do i get rid, i have been googling for hours now and cant find an answer.

please see this screen shot to see what i mean
 
Set the WindowState property of your child form to "Maximized.
 
The form is set to maximized, however just below the application title bar there is a second set of buttons for min / max / closed which control the mdi child
 
Well, Excel still allows you to minimize and maximize the MDI child, at least in the 2002 version which I am using. Perhaps MDI is not the best solution for you. You can try using a panel, user control, or embedding a form within a form if you can't get the behavior you want from MDI.
 
These may seem like silly questions, but I just want to check...

On your container form, did you set the "IsMDIContainer" property to True?

How are you opening your child forms? Are you setting the child form's .MdiParent property to the container form?
 
Yes, the parent is set to MDI Container and when i load the forms i set the mdi parent and then .show

But i still get the controls when the mdichild is maximized even if the showclose and showminimize etc properties are set to false. I have also tried setting the form border to none.
 
When I create a new CHILD form, the only properties I change are...

WindowState - Maximized
ControlBox - False (You don't have to set the Minimize, Maximize to false if you set ControlBox to false)
StartPosition - CenterParent (this one probably isn't even necessary)

And, of course, the name, text, size...
 
Make sure the ControlBox is set to false before the WindowState is set to Maximized. And make sure both are done before you show the form. That should fix it, but if that doesn't work post your code.

-I hate Microsoft!
-Forever and always forward.
-My kingdom for a edit button!
 
You can also put this in the child form's Resize event handler:

Me.WindowState = FormWindowState.Maximized

Then is the form is minimized or restored down, it immediately snaps back to Maximized.


I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 

Its the maximize setting that's causing you grief. Try docking it in the MDI Parent window instead.
Something like this:

Code:
        With mForm2
            .MdiParent = Me
            .ControlBox = False
            .Text = [String].Empty
            .WindowState = FormWindowState.Normal
            .FormBorderStyle = Windows.Forms.FormBorderStyle.FixedToolWindow
            .Dock = DockStyle.Fill
            .Show()
        End With

 
i have tried the exact code you pasted pmegan however i still get the bar across top. Very Annoying

I also tried setting the borderstyle to none and docking but again no luck.

There has to be a way, that grey bar is ruining my nice new GUI :)

jebenson cheers, that fixes another problem I have been having .
 

Weird; I was having the same problem last night and that snippet fixed it for me. I copied it directly from my code.

 
Ah ha,

Sorted it.

I had put jebenson's code in the resize event of my base form from which i inherit so everytime i set the dockstyle the form resized and maximized.

Removed that and it works like a treat :)
 
All you had to do when creating a new child is:
Code:
Dim Child As New Form2
Child.MdiParent = Me
Child.ControlBox = False
Child.WindowState = FormWindowState.Maximized
Child.Show()
If you do the ControlBox after Maximized it sometimes ignores it. If you do either after showing it is to late because the form is already created. Really I should say sometimes maximize will work after the show and not re-enable the ControlBoxes and sometimes it will not. I have no clue why.

Really the big question to ask is why have an mdi window if you are just going to maximize it? Really you should use something like a TabControl. Mdi can be really picky sometimes if you try to get around its normal behaviors.

-I hate Microsoft!
-Forever and always forward.
-My kingdom for a edit button!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top