Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Proper approach to dealing with Auto-scaling

I'm working with another developer on a WinForms application, and we are having a big problem with the appearance related to auto scaling.

My system (a Sony VAIO) defaults to 125% on this menu:

Display scaling

From what I can tell, 125% sets the DPI to 120, and default font size (menus, etc.) to 11pt. On the other developer's system, his defaults to 100%, which is 96 dpi, and 9pt font. I'm not sure, but I think only the DPI is what is causing us grief.

The problem manifests itself with text being the wrong size, and either covering up other controls, or being way too spaced out (depending on who had it open in designer last). As far as I can tell, all ContainerControls are set to AutoScaleMode.Inherit, and the top-level form is AutoScaleMode.Dpi. Is this what most other people use?

like image 572
Jonathon Reinhart Avatar asked Jun 25 '12 21:06

Jonathon Reinhart


1 Answers

I had the same problem with one of my applications. The answer was to move it to WPF. The solution that I came with when I still used WinForms was to have 2 executable files. One developed under 96DPI and the other under 120DPI. It was double effort, but I have tried any layout configurations without success. If my controls were looking fine on 96DPI, when switching to 120DPI, they were out of the window's application. And viceversa.

WPF is the only solution to this annoying problem.

like image 142
Alexandru Dicu Avatar answered Oct 13 '22 20:10

Alexandru Dicu