MDI behavior is strange. please help
Is there away to prevent an MDI child form from being auto maximized?
The problem I have is this. I have an mdi application that contains 2 mdi child forms. When I show the first form and maximize it so that it fills the mdi window I can't load the second form non maximized.
Vb.net automatically maximizes the second form despite the fact that I didn't tell it too! If I then restore the second form to its normal size it then does the same with the first form. This is all very strange to me. When you maximize one form inside an MDI window it maximizes them all. how do you stop this from happening?
What I want is the first form to stay maximized and the second for to appear on top not maximized.
here is the code I'm using to display the second form (the one I don't want to be maximized)
I'm loading this form from the menu so 'ME' is the MDI Parent form
Dim frm As frm2
frm = New frm2
frm.MdiParent = Me
frm.Show()
When I click on the menu and execute the code above I have the first form maximized. I don't want this to happen. I want frm2 to appear inside the MDI form and I don't want it to be maximized.
I've tried changing the window style but that dosn't work either. I also don't want to call frm2.ShowDialog() because it makes the form appear outside the MDI window.
Re: MDI behavior is strange. please help
As far as i am aware, the data in this thread is in correct. The form can be set to not maximize on MDI child form load. As i have two programs that do not maximize the forms
here is some ideas.. Be sure on the form your loading that the .WindowState property is not set to maximized, in the property section for the form as well as in the formload section.. as well as to where you call the form to be loaded.
Re: MDI behavior is strange. please help
@TheUsed: The problem is, regardless of the settings on the form at design-time, if the user clicks the "maximize" button in the MDI child form's title bar and maximizes it, then opens any new MDI child, that newly opened child will also be maximized. As far as I know, this is the behavior of all standard MDI applications.
Re: MDI behavior is strange. please help
@00Kevin - this is standard, normal, expected behaviour of MDI windows....
@cyberHawk - true, but then that means the form isn't contained in the MDI Parent, and can be moved outside the confines of the app.... may or may not be what you want.
@taxes - that's probably the way I'd go with it.... on the form resize event, check the WindowState property and if it's been set to maximize, reset it to "normal" and then (using the .Move method) resize the form so that its width and height match that of the MDI Parent client window area.
@carlblanchard -as nice as it sounds... there's no such thing as a MaxWidth or a Max Height property... wish it were that easy.
-tg
Re: MDI behavior is strange. please help
oh! okay yeah, I will have to agree with that being the standard.
Thank you for that clearification