0

I am having a problem with my Visual Studio. Form always change its size at runtime.

The form's size when designed is 1732; 1005 as shown in the figure below:

enter image description here

But when I run the program, the form's size changes to a smaller size (new size: 868;491) as shown below: enter image description here

I already tried changing the DPI and the resolution of the PC that I am using but it's still the same. What will I change to get the actual size of the designed UI at runtime?

ThEpRoGrAmMiNgNoOb
  • 1,256
  • 3
  • 23
  • 46
  • try setting your form's `MinimumSize` and see if it helps, if it does, you probably have set `AutoSize` to `true` – am05mhz Oct 26 '16 at 03:12
  • @am05mhz I already tried setting the `MinimumSize` but it's still the same. I also checked the `AutoSize` property and it's set to false. – ThEpRoGrAmMiNgNoOb Oct 26 '16 at 03:16
  • hmm, that is odd indeed, are you using a hires monitor? – am05mhz Oct 26 '16 at 03:20
  • Yah. My current resolution is 1920x1080. I also tried using other resolutions but that didn't help. – ThEpRoGrAmMiNgNoOb Oct 26 '16 at 03:28
  • Typical Windows 10 question. It assumes that every program today is dpiAware, Visual Studio and the Winforms designer certainly are, it is just programmers that are not. You get a very early preview of what your program will look like on an old machine. Just tell Windows that [you are dpiAware](http://stackoverflow.com/a/13228495/17034) and you can ignore it for a while longer. – Hans Passant Oct 26 '16 at 05:59

3 Answers3

1

Try setting "AutoScaleMode" on the form to "None". I found my form was set to mode "Font". After I changed the font size on a few GUI components, the form's layout was far different at run time from what I saw in the designer. After setting the scale mode to "None", the form looked great at run time.

James G
  • 11
  • 2
0

Try setting FormBorderStyle to FixedDialog or something related to Fixed****. Also you can try setting MinimumSize and MaximumSize to 1732; 1005.

Mukul Varshney
  • 3,131
  • 1
  • 12
  • 19
0

Could it be, that the forms AutoSize = true and AutoSizeMode = GrowAndShrink? Then change AutoSize to false or set AutoSizeMode to GrowOnly