If have more than one childform in the Parent form, and i maximize one child form then the remaining child forms also gets maximized automatically. How can i prevent this to happen ?
Printable View
If have more than one childform in the Parent form, and i maximize one child form then the remaining child forms also gets maximized automatically. How can i prevent this to happen ?
Put this into the Form's Activated event handler:
Code:Me.WindowState = FormWindowState.Normal
That's how MDI works. That's how it's supposed to work and that's how it always works. If one child is maximised then they all are. If one isn't then none of them are.
JMC, Is there anyway this can be avoided ?
I recently had the opposite problem - the first MDI child was in its normal window state despite its "WindowState" property being set to "Maximized" at design time. Subsequent MDI forms are maximised even if the "WindowState" property is set to "Normal" at design time.
To alter this behaviour, the "WindowState" property of the MDI child must be set at runtime in either the form's load or activated event procedure depending on which outcome you are trying to achieve.
i have set the windowstate property of my mdi child to normal in the load event. But still i'm facing this problem.
It needs to go into the MDI Child Form's Activated event handler - see Post #2 above.Quote:
Originally Posted by robertx
To always make the MDI child's window state normal:
To always make the MDI child's window state maximised:Code:Private Sub Form1_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Activated
Me.WindowState = FormWindowState.Normal
End Sub
Code:Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Me.WindowState = FormWindowState.Maximized
End Sub
could always use the Resize event with this code:
If Me.WindowState = WindowState.Maximized Then Me.WindowState = WindowState.Normal