Whenever I minimize or maximize an MDI Parent form while it has a child form maximized, the height of the MDI Parent shrinks by roughly 20px.
I started out with .Net Framework 4.0 and had this problem, so I tried other versions and continued to have problem.
Here are some steps to replicate (trying 4.7.1 this time):
- Closed all instances of VS2017 and open VS2017.
- File > New > Project.
- Name: MdiTest2; Framework 4.7.2; Hit OK.
- Set Form1 "IsMdiContainer" to True.
- Right-click project > Add > Windows Form... Called this ChildForm.vb.
- Went back to Form1, doubl-clicked form.
- Set Form1 load event to following:
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim frm As New ChildForm
frm.MdiParent = Me
frm.WindowState = FormWindowState.Maximized
frm.Show()
End Sub
- Started debugging
- Drag Parent form somewhere so that you'll notice changes to height of form (align the bottom of form with another form, icon, or top of taskbar).
- Maximize the form and then click restore button... Notice form resizes
- Minimize the form and then click the icon for it on the taskbar...
- Notice the form resizes (for me), the top of the form stays at original location, but the bottom border moves up ~20px.
- If I continue to click the apps icon on taskbar, it will continue to shrink ever time the form is restored.
Is anyone able to replicate this or is this just a bug on my machine? My resolution is 2560x1440 and scaling is set to 100%. If I change AutoScaleMode on Form1 and ChildForm from "Font" (default) to "None", I still have this problem. If I do not have an MDI Child form maximized when I Minimize/Maximize the MDI Parent, the MDI Parent height does not shrink when restored.