vb.netwinformsfonts.net-2.0

Winforms :: Why changing Form Font resize some controls?


All my forms inherit from one base form where we handle background paint and set standard properties.

I recently considered checking if the app is running on Vista or Later to use Segoe UI font, and I added this.

The problem is that inherited forms changed sizes and their inner controls changed also... even PictureBoxes!! The controls and forms seem thinner (in width), so the square picturebox became vertical rectangles!

Some time ago when I changed from the standard (?) Sans Serif to Verdana, the same happened but at that time my app was way smaller and I checked and fixed every form... now with hundreds of forms it is not handy.

Any idea why this happened and what could be the way to work around it?


Solution

  • Just change the AutoScaleMode property of the Form. By default it will be Font, so if you change the Font property it will resize the Form. You can get more information about it from AutoScaleMode Enumeration in MSDN :