Windows Forms application on Windows 10 does not scale properly

When running one of our Windows Forms applications on Windows 10, the graphical interface looks pretty bad, because the scaling seems to be confused. Here are some screenshots of 1920x1080 (note the different sizes of the second pair): Win 10

Win 7

Win 10

Win 7

The scaling option in the Windows 10 display settings is set to 100% (therefore, no additional scaling is required). In addition, when the program starts, the following code is executed:

static void Main() { if (Environment.OSVersion.Version.Major >= 6) //Windows Vista and higher SetProcessDPIAware(); //disable DPI scaling (or something like that) to avoid scaling problems on Windows 10 Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(Hauptmenue.Instance); } 

This block of code helps a bit, as it looks much worse on Windows 10 without. But this is not very good ... does anyone know how to "restore" the GUI so that it looks exactly the same as in Windows 7 or 8?

+5
source share
2 answers

Try changing the settings in Windows 7 and Windows 8 to 100%. I don't think this is a Windows 10 issue. This is probably because the default settings in Windows 10 are different.

You can try to β€œplay” with the AutoScaleMode Enumeration .

Try setting the mode for the form to None or Dpi, for example, described here :

 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; 

Also read the answer in this SO question about scaling across different controls.

+4
source

I had a similar problem. Some group groups displayed too widely in a Windows Forms application. He worked on a Windows 7 laptop, but not on Windows, but on 10.

Setting DPI scaling from 125% to 100% on Windows 10 worked for me. AutoSizeScaleMode was a font.

0
source

All Articles