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
  1. Home
  2. General Programming
  3. C#
  4. Resize all controls on a user control or form automatically with changing of user control or form

Resize all controls on a user control or form automatically with changing of user control or form

Scheduled Pinned Locked Moved C#
20 Posts 10 Posters 0 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.
  • U User 13293914

    HI, Thank you for your help. do you know an essay through the site?if yes, could you please send its link to me?i have tried to do this but i could not overcom.

    P Offline
    P Offline
    phil o
    wrote on last edited by
    #8

    #realJSOP wrote:

    set up an event handler for the form's size changed event

    Creating Event Handlers in Windows Forms | Microsoft Docs[^] Control.SizeChanged Event | Microsoft Docs[^]

    #realJSOP wrote:

    iterate all of the controls you want to resize

    How do I Iterate controls in a windows form app? | StackOverflow[^] Walkthrough: Arranging Controls on Windows Forms Using a TableLayoutPanel | Microsoft Docs[^] could also help.

    noop()

    1 Reply Last reply
    0
    • U User 13293914

      Hi, i want to resize (Readjust) all of the controls that are belongs to a Form or User Control while i am resizing the User Control or the Form. I already have used from both docking and anchoring , but non of them are working properly. Is there any way to create a class to overcome this. i also searched but i did not get any proper answer. i will be thankful if you professionals coach me to do it. Thank you in advance.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #9

      Since you didn't mention a platform ... [Responsive layouts with XAML - Windows UWP applications | Microsoft Docs](https://docs.microsoft.com/en-us/windows/uwp/design/layout/layouts-with-xaml)

      "(I) am amazed to see myself here rather than there ... now rather than then". ― Blaise Pascal

      U 1 Reply Last reply
      0
      • L Lost User

        Since you didn't mention a platform ... [Responsive layouts with XAML - Windows UWP applications | Microsoft Docs](https://docs.microsoft.com/en-us/windows/uwp/design/layout/layouts-with-xaml)

        "(I) am amazed to see myself here rather than there ... now rather than then". ― Blaise Pascal

        U Offline
        U Offline
        User 13293914
        wrote on last edited by
        #10

        Hi, SOOooooooory, i forgot. i am using c# and windows application.

        1 Reply Last reply
        0
        • OriginalGriffO OriginalGriff

          No, that doesn't make any sense. Stop trying to type as little as possible and explain in detail, remembering that we can't see your screen, access your HDD, or read your mind - we only get exactly what you type to work with. So we have no idea what anchor settings you used, or how your controls are arranged to start with - we don't even know if "resize" means your form "getting bigger" or "getting smaller"; "taller", "shorter", "both"; all of the above!

          Sent from my Amstrad PC 1640 Never throw anything away, Griff Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!

          U Offline
          U Offline
          User 13293914
          wrote on last edited by
          #11

          Hi, excuse me, you're right. i am using c# and winApp. i want to change controls of a form or an user control in the same time with resizing the form or user control with mouse down movment in any direction (N,E,WS,NE,NW,SE,SW) and also with minimizing the and maximizing the form or user control. thank you for you help.

          OriginalGriffO 1 Reply Last reply
          0
          • U User 13293914

            Hi, i want to resize (Readjust) all of the controls that are belongs to a Form or User Control while i am resizing the User Control or the Form. I already have used from both docking and anchoring , but non of them are working properly. Is there any way to create a class to overcome this. i also searched but i did not get any proper answer. i will be thankful if you professionals coach me to do it. Thank you in advance.

            M Offline
            M Offline
            Mycroft Holmes
            wrote on last edited by
            #12

            Don't - simply design for the smallest acceptable monitor size, use docking, and accept that larger monitors will have a lot of white space. This is the generally accepted solution to different monitor size/resolution. A control designed for 1280x960 looks bloody silly stretched to 1920x1024.

            Never underestimate the power of human stupidity - RAH I'm old. I know stuff - JSOP

            1 Reply Last reply
            0
            • U User 13293914

              Hi, i want to resize (Readjust) all of the controls that are belongs to a Form or User Control while i am resizing the User Control or the Form. I already have used from both docking and anchoring , but non of them are working properly. Is there any way to create a class to overcome this. i also searched but i did not get any proper answer. i will be thankful if you professionals coach me to do it. Thank you in advance.

              L Offline
              L Offline
              Luc Pattyn
              wrote on last edited by
              #13

              sometimes useful: SplitContainer Class (System.Windows.Forms) | Microsoft Docs[^] Can be nested. :)

              Luc Pattyn [My Articles] Nil Volentibus Arduum

              1 Reply Last reply
              0
              • U User 13293914

                Hi, excuse me, you're right. i am using c# and winApp. i want to change controls of a form or an user control in the same time with resizing the form or user control with mouse down movment in any direction (N,E,WS,NE,NW,SE,SW) and also with minimizing the and maximizing the form or user control. thank you for you help.

                OriginalGriffO Offline
                OriginalGriffO Offline
                OriginalGriff
                wrote on last edited by
                #14

                So you're not listening to a word I say, just posting no information? Is there any point in trying to ask a question if you can't be bothered to tell us what we need to know?

                Sent from my Amstrad PC 1640 Never throw anything away, Griff Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!

                "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
                "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

                U 1 Reply Last reply
                0
                • U User 13293914

                  Hi, i want to resize (Readjust) all of the controls that are belongs to a Form or User Control while i am resizing the User Control or the Form. I already have used from both docking and anchoring , but non of them are working properly. Is there any way to create a class to overcome this. i also searched but i did not get any proper answer. i will be thankful if you professionals coach me to do it. Thank you in advance.

                  B Offline
                  B Offline
                  BillWoodruff
                  wrote on last edited by
                  #15

                  1. by using a combination of docked controls, and other controls that are anchored, you can achieve pretty good proportional UI re-sizing in WinForms. 2. you will not achieve good quality arbitrary proportional font re-sizing in WinForms because of changes in font rendering: fonts are rendered clearly in certain fixed "quantum state sizes" ... you want more than that, use WPF, where fonts, like everything else, get run through the vector graphic engine. I will respond further if you start giving details of your UI structure, and get specific. Describe what AutoSizeMode setting you are using; describe what is docked, and not docked.

                  «Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot

                  U 1 Reply Last reply
                  0
                  • B BillWoodruff

                    1. by using a combination of docked controls, and other controls that are anchored, you can achieve pretty good proportional UI re-sizing in WinForms. 2. you will not achieve good quality arbitrary proportional font re-sizing in WinForms because of changes in font rendering: fonts are rendered clearly in certain fixed "quantum state sizes" ... you want more than that, use WPF, where fonts, like everything else, get run through the vector graphic engine. I will respond further if you start giving details of your UI structure, and get specific. Describe what AutoSizeMode setting you are using; describe what is docked, and not docked.

                    «Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot

                    U Offline
                    U Offline
                    User 13293914
                    wrote on last edited by
                    #16

                    Hi, Thank you for your help and advise. i am trying to create a class to justify all of the components of the forms and user controls (each one of them, separately). I think it is possible. when i try to use from anchoring or docking, with resizing the form or user control, for instance, textBoxes will go under Buttons (some of them will move). my aim is to justify all controls belongs to a parent while resizing the parent with mouse movement and maximizing. thanks a million to care about my question.

                    B 1 Reply Last reply
                    0
                    • OriginalGriffO OriginalGriff

                      So you're not listening to a word I say, just posting no information? Is there any point in trying to ask a question if you can't be bothered to tell us what we need to know?

                      Sent from my Amstrad PC 1640 Never throw anything away, Griff Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!

                      U Offline
                      U Offline
                      User 13293914
                      wrote on last edited by
                      #17

                      Hi, Excuse me if i did not ask my question properly. i only want to know is it possible to create a class to resize controls belong to a parent while i am resizing my parent (Form or user control)? because when i am using from anchoring and docking in the controls properties, sizes are will changed but the controls will go under/Over each other. i do not know what else shall i post! :doh: Thank you for your kindly trying to help me:rose::rose::rose:.

                      D 1 Reply Last reply
                      0
                      • U User 13293914

                        Hi, Thank you for your help and advise. i am trying to create a class to justify all of the components of the forms and user controls (each one of them, separately). I think it is possible. when i try to use from anchoring or docking, with resizing the form or user control, for instance, textBoxes will go under Buttons (some of them will move). my aim is to justify all controls belongs to a parent while resizing the parent with mouse movement and maximizing. thanks a million to care about my question.

                        B Offline
                        B Offline
                        BillWoodruff
                        wrote on last edited by
                        #18

                        Member 13325846 wrote:

                        textBoxes will go under Buttons (some of them will move).

                        Changing the z-order at run-time: you don't want to go there. While I have a sense of what you want to do, you are not specific enough for me to offer further comment. You did not respond to the issue I raised about the problems of trying to scale fonts in WinForms. I suggest you make three visual mock-ups showing the initial UI state, and that initial state sized larger, and smaller. Post links to those pictures here.

                        «Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot

                        1 Reply Last reply
                        0
                        • U User 13293914

                          Hi, i want to resize (Readjust) all of the controls that are belongs to a Form or User Control while i am resizing the User Control or the Form. I already have used from both docking and anchoring , but non of them are working properly. Is there any way to create a class to overcome this. i also searched but i did not get any proper answer. i will be thankful if you professionals coach me to do it. Thank you in advance.

                          R Offline
                          R Offline
                          Ralf Meier
                          wrote on last edited by
                          #19

                          According the the discussion until now and the given answers and comments : If you want to resize controls when resizing the container-control (Form, Panel, Usercontrol and so on) you have to memorize the location of each control and it's size depending on the Master-Form. If you now resize the Form each control in it must shrink or grow and each location must be shifted - depending on the changes. For this Anchors and so on are now helpful. You need to create a method which is called with the Form.SizeChanged-Event. If you do it like this you should know, that not every Control does a properly resizing. Also it will be possible that the look becomes very strange.

                          1 Reply Last reply
                          0
                          • U User 13293914

                            Hi, Excuse me if i did not ask my question properly. i only want to know is it possible to create a class to resize controls belong to a parent while i am resizing my parent (Form or user control)? because when i am using from anchoring and docking in the controls properties, sizes are will changed but the controls will go under/Over each other. i do not know what else shall i post! :doh: Thank you for your kindly trying to help me:rose::rose::rose:.

                            D Offline
                            D Offline
                            Dave Kreskowiak
                            wrote on last edited by
                            #20

                            If you're looking to create a class to handle this for you, that's not going to work. You've simply got more learning to do to properly handle setting up your layouts with TableLayoutPanel, FlowLayoutPanel, Docking, Anchoring, any other containers, ... It's not a simple "Ask a question and get an answer that will fix everything". The only answer to this problem is more learning and experimentation. We can't see your layout and screen shots isn't going to help that because we also cannot see the properties of your controls and containers.

                            Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
                            Dave Kreskowiak

                            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