Control proportions other than runtime and designer

I am currently modifying an existing C # WinForm project. I am trying to organize some controls inside a GroupBox. However, at runtime, they seem to be aligned differently, and Groupbox has a lot more room. Is there an installed option or is this standard behavior? Any tips are greatly appreciated! Thanks!

Here's what it looks like, as you can see that there is no way to check the flags, except for trial and error. At run time, there is enough free space to have four columns in one row, in the designer I can hardly fit in three without overlapping them.

Left - Designer, Right - Runtime

+4
source share
4 answers

To prevent a group field from resizing to fit its contents, you must set GroupBox.AutoSize to false .

  GroupBox groupBox = new GroupBox(); groupBox.AutoSize= false; 
+1
source

check the Size property and check if it has been changed to ensure that the checkbox Location remains unchanged in different sizes of the form, use the anchor property and set it to the left or left above.

basically it should be size if autoSize off. Check the initial size and size after the form is displayed. it doesn't have to be the same, but if so, you can set it smaller

+1
source

Check the Anchor checkbox on the checkboxes. It looks like some of them may be tied to the right.

0
source

Not sure if this applies to these checkboxes, but AutoScaleMode can affect the scaling of the form. Set it to No to make sure it does not scale. AutoScaleMode = None

0
source

Source: https://habr.com/ru/post/1498301/


All Articles