MDI Parent window height shrinks on restore (after minimize/maximize) if an MDI child is maximized












0















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):




  1. Closed all instances of VS2017 and open VS2017.

  2. File > New > Project.

  3. Name: MdiTest2; Framework 4.7.2; Hit OK.

  4. Set Form1 "IsMdiContainer" to True.

  5. Right-click project > Add > Windows Form... Called this ChildForm.vb.

  6. Went back to Form1, doubl-clicked form.

  7. 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



  1. Started debugging

  2. 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).

  3. Maximize the form and then click restore button... Notice form resizes

  4. Minimize the form and then click the icon for it on the taskbar...

  5. Notice the form resizes (for me), the top of the form stays at original location, but the bottom border moves up ~20px.

  6. 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.










share|improve this question



























    0















    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):




    1. Closed all instances of VS2017 and open VS2017.

    2. File > New > Project.

    3. Name: MdiTest2; Framework 4.7.2; Hit OK.

    4. Set Form1 "IsMdiContainer" to True.

    5. Right-click project > Add > Windows Form... Called this ChildForm.vb.

    6. Went back to Form1, doubl-clicked form.

    7. 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



    1. Started debugging

    2. 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).

    3. Maximize the form and then click restore button... Notice form resizes

    4. Minimize the form and then click the icon for it on the taskbar...

    5. Notice the form resizes (for me), the top of the form stays at original location, but the bottom border moves up ~20px.

    6. 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.










    share|improve this question

























      0












      0








      0








      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):




      1. Closed all instances of VS2017 and open VS2017.

      2. File > New > Project.

      3. Name: MdiTest2; Framework 4.7.2; Hit OK.

      4. Set Form1 "IsMdiContainer" to True.

      5. Right-click project > Add > Windows Form... Called this ChildForm.vb.

      6. Went back to Form1, doubl-clicked form.

      7. 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



      1. Started debugging

      2. 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).

      3. Maximize the form and then click restore button... Notice form resizes

      4. Minimize the form and then click the icon for it on the taskbar...

      5. Notice the form resizes (for me), the top of the form stays at original location, but the bottom border moves up ~20px.

      6. 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.










      share|improve this question














      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):




      1. Closed all instances of VS2017 and open VS2017.

      2. File > New > Project.

      3. Name: MdiTest2; Framework 4.7.2; Hit OK.

      4. Set Form1 "IsMdiContainer" to True.

      5. Right-click project > Add > Windows Form... Called this ChildForm.vb.

      6. Went back to Form1, doubl-clicked form.

      7. 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



      1. Started debugging

      2. 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).

      3. Maximize the form and then click restore button... Notice form resizes

      4. Minimize the form and then click the icon for it on the taskbar...

      5. Notice the form resizes (for me), the top of the form stays at original location, but the bottom border moves up ~20px.

      6. 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.







      vb.net visual-studio-2017 mdi mdiparent






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 19 '18 at 21:11









      Daniel PDaniel P

      112




      112
























          1 Answer
          1






          active

          oldest

          votes


















          1














          After doing a lot of searching and not finding anyone else with this bug, I started asking myself: "why would others not have this problem". Well, my program will not have a MenuStrip, but almost all MDI parent forms have one. So, on a hunch, I added a menu strip to the form and it fixed my problem. I then set the visibility of the MenuStrip to false and tested... it still works with MenuStrip visibility set to false.






          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53382697%2fmdi-parent-window-height-shrinks-on-restore-after-minimize-maximize-if-an-mdi%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            After doing a lot of searching and not finding anyone else with this bug, I started asking myself: "why would others not have this problem". Well, my program will not have a MenuStrip, but almost all MDI parent forms have one. So, on a hunch, I added a menu strip to the form and it fixed my problem. I then set the visibility of the MenuStrip to false and tested... it still works with MenuStrip visibility set to false.






            share|improve this answer




























              1














              After doing a lot of searching and not finding anyone else with this bug, I started asking myself: "why would others not have this problem". Well, my program will not have a MenuStrip, but almost all MDI parent forms have one. So, on a hunch, I added a menu strip to the form and it fixed my problem. I then set the visibility of the MenuStrip to false and tested... it still works with MenuStrip visibility set to false.






              share|improve this answer


























                1












                1








                1







                After doing a lot of searching and not finding anyone else with this bug, I started asking myself: "why would others not have this problem". Well, my program will not have a MenuStrip, but almost all MDI parent forms have one. So, on a hunch, I added a menu strip to the form and it fixed my problem. I then set the visibility of the MenuStrip to false and tested... it still works with MenuStrip visibility set to false.






                share|improve this answer













                After doing a lot of searching and not finding anyone else with this bug, I started asking myself: "why would others not have this problem". Well, my program will not have a MenuStrip, but almost all MDI parent forms have one. So, on a hunch, I added a menu strip to the form and it fixed my problem. I then set the visibility of the MenuStrip to false and tested... it still works with MenuStrip visibility set to false.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 19 '18 at 22:04









                Daniel PDaniel P

                112




                112
































                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53382697%2fmdi-parent-window-height-shrinks-on-restore-after-minimize-maximize-if-an-mdi%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    這個網誌中的熱門文章

                    Tangent Lines Diagram Along Smooth Curve

                    Yusuf al-Mu'taman ibn Hud

                    Zucchini