Form Automatically Maximising in MDI Parent

I have created a form in VS2010

The only things that i have changed from the defult on the form are to set the forms MDIParent, set "ControlBox = False" and "StartPosition = Center Screen"

when i open the form it opens in the MDI Container but fills the screen rather than just being its set size and being positioned centrally.

can anybody tell me why?
LVL 1
ict-torquilclarkAsked:
Who is Participating?
 
ict-torquilclarkAuthor Commented:
I think the best option is to go with opening the form as a dialog

Thanks for all the suggestions.
0
 
Jacques Bourgeois (James Burger)PresidentCommented:
The Location, Size and StartPosition are disregarded when WindowState is Maximized.

The form you are opening as a child probably has its own WindowState property set to Maximized.
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
Can you show some code?...I can't reproduce the problem:  
private void button1_Click(object sender, EventArgs e)
        {
            Form2 f2 = new Form2();
            f2.ControlBox = false;
            f2.StartPosition = FormStartPosition.CenterScreen;
            f2.MdiParent = this;
            f2.Show();
        }

Open in new window

Idle-Mind-511440.flv
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
Mike TomlinsonMiddle School Assistant TeacherCommented:
*If you have other MdiChildren already displayed in a Maximized state, then new MdiChildren would also display Maximized.
0
 
ict-torquilclarkAuthor Commented:
i do already have an mdi child object maximised, so that is what causes it :o)

Is there a way to make the new form display not maximised, whilst having the other fom open maximised?
0
 
CodeCruiserCommented:
I think you either have all forms maximized or all in normal state. One option is to show this form as modal.
0
 
ict-torquilclarkAuthor Commented:
i didnt know that was still possible...

form1.show(1) ?
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
After the new MdiChild opens, change its WindowState property to Normal.  You could use the Shown() event.
0
 
Jacques Bourgeois (James Burger)PresidentCommented:

Look at all the MDI forms you have used. They do not permit that kind of thing. Its either maximized, normal or minimized.

The only way to have both is to have the non-maximized form be something else than a child.

For a modal form (dialog), it would simply be to open it centered in its owner. Since it needs to be closed before returning to the parent, everything would be fine.

For a non modal form, then things are a little more complicated. You will have to work a bit to toggle the visible property of the small form when the user switch back and forth between the MDI and the small form. You will also have to subscribe to a few events in order for the small form to "follow" the MDI if it is moved around.
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
To clarify, all MdiChildren share the same "current" WindowState.  So you can't have some MdiChildren maximized while others are not.  If you want the new MdiChild to open "normal" then you can change it after it opens as I stated...but then all other MdiChildren would also change to the "normal" state as well.
0
 
CodeCruiserCommented:
>To clarify, all MdiChildren share the same "current" WindowState.

Except the Minimized state right?
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
Yesh...  ;)
0
 
mlmccCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.