Search code examples
c#autosize

Auto size items on form


I have a form with buttons, groupboxes etc. that looks like this:

enter image description here

The problem is that this form doesnt fit on some smaller resolutions. How can I make this form so that all its components would resize? I tried anchors and autosize preperties but I could only get it to work for picturebox.

enter image description here


Solution

  • What anchor and autosize settings did you use?

    Long story short, use the anchor and dock properties.

    See an example and explanation HERE.

    I made a test example (for visuals), and you can see the anchor properties I used for an example group box that has a picture box below it. It scales left and right and up, but not downward (which would cover the picture box). You can then use similar border properties and settings to set the positions of the buttons and elements within the group box. See the group box properties image:

    Group Box Properties Image