Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. Problem with resizing controls on form resize

Problem with resizing controls on form resize

Scheduled Pinned Locked Moved Visual Basic
questionhardwarehelp
7 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sohaib_a
    wrote on last edited by
    #1

    I have a form with other forms added to it as controls. I am using the anchoring property of the forms so that when i maxmize the main form,the embedded form maxmizes as well.This works fine when both the main form and chid form are open at same time and in normal window state and then i maximize the main form. However,when only the main form is maximized first and then i open the child form in it,it doesn't open as maxmized,it opens in normail window state. What is going wrong here?How can i make the form autmotically resize it self depending on the window state of the main form.

    W 1 Reply Last reply
    0
    • S sohaib_a

      I have a form with other forms added to it as controls. I am using the anchoring property of the forms so that when i maxmize the main form,the embedded form maxmizes as well.This works fine when both the main form and chid form are open at same time and in normal window state and then i maximize the main form. However,when only the main form is maximized first and then i open the child form in it,it doesn't open as maxmized,it opens in normail window state. What is going wrong here?How can i make the form autmotically resize it self depending on the window state of the main form.

      W Offline
      W Offline
      Wendelius
      wrote on last edited by
      #2

      Sohaib_A wrote:

      when only the main form is maximized first and then i open the child form in it,it doesn't open as maxmized,it opens in normail window state

      If you're using MDI, this expected behaviour. MDI children are not sized based on MDI parent when opening. You control the window state of a MDI child independently. If you want you can set the windowstate to maximized when you create the child window if the parent is maximized. However if the child window is always taking all the space in MDI container, it isn't acting like a MDI application. It sounds more like a SDI application, like Visual Studio editor.

      The need to optimize rises from a bad design.My articles[^]

      S 1 Reply Last reply
      0
      • W Wendelius

        Sohaib_A wrote:

        when only the main form is maximized first and then i open the child form in it,it doesn't open as maxmized,it opens in normail window state

        If you're using MDI, this expected behaviour. MDI children are not sized based on MDI parent when opening. You control the window state of a MDI child independently. If you want you can set the windowstate to maximized when you create the child window if the parent is maximized. However if the child window is always taking all the space in MDI container, it isn't acting like a MDI application. It sounds more like a SDI application, like Visual Studio editor.

        The need to optimize rises from a bad design.My articles[^]

        S Offline
        S Offline
        sohaib_a
        wrote on last edited by
        #3

        I am not using mdi. Just adding the form as a control to the main form. Dim as new form1 Me.controls.add(f) 'I also set the anchor properties for form1 here this is how i am doing it.

        S W 2 Replies Last reply
        0
        • S sohaib_a

          I am not using mdi. Just adding the form as a control to the main form. Dim as new form1 Me.controls.add(f) 'I also set the anchor properties for form1 here this is how i am doing it.

          S Offline
          S Offline
          sohaib_a
          wrote on last edited by
          #4

          'If you want you can set the windowstate to maximized when you create the child window if the parent is maximized.' I tried this but then the form cover the entire area of the main form.I have a menu strip on the left which gets covered by it.The menu strip has to be seen all the time.

          1 Reply Last reply
          0
          • S sohaib_a

            I am not using mdi. Just adding the form as a control to the main form. Dim as new form1 Me.controls.add(f) 'I also set the anchor properties for form1 here this is how i am doing it.

            W Offline
            W Offline
            Wendelius
            wrote on last edited by
            #5

            Ok, so this is more like SDI. Instead of using forms, could you create a user control and place the contents you now have in a form to the user control. Then add the user control to the form you're using as a main form. Possibly add a tab where you place the user control if you want to have several tabs at the same time etc.

            The need to optimize rises from a bad design.My articles[^]

            S 1 Reply Last reply
            0
            • W Wendelius

              Ok, so this is more like SDI. Instead of using forms, could you create a user control and place the contents you now have in a form to the user control. Then add the user control to the form you're using as a main form. Possibly add a tab where you place the user control if you want to have several tabs at the same time etc.

              The need to optimize rises from a bad design.My articles[^]

              S Offline
              S Offline
              sohaib_a
              wrote on last edited by
              #6

              Thanks for the suggestion,i could use it for my later projects.But the thing right now is that I have already made the forms ,there are several and converting them to a user control would take time.Is there any other method in you opinion?

              W 1 Reply Last reply
              0
              • S sohaib_a

                Thanks for the suggestion,i could use it for my later projects.But the thing right now is that I have already made the forms ,there are several and converting them to a user control would take time.Is there any other method in you opinion?

                W Offline
                W Offline
                Wendelius
                wrote on last edited by
                #7

                Well you could try to reset the anchoring in the code. Set anchoring to none in design time and set it after creating the form. Not sure, but it could help.

                The need to optimize rises from a bad design.My articles[^]

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups