Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows Forms application on Windows 10 not scaling properly

When running one of our Windows forms applications on Windows 10, the GUI looks pretty bad since the scaling seems to be messed up. Here are some 1920x1080 screenshots (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% (so no extra scaling should be applied). Furthermore, the following code is executed at program start:

  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 code block helps a little, since it looks a lot worse on Windows 10 without. But this is not good enough...does anyone know how to "restore" the GUI to look exactly like on Windows 7 or 8?

like image 658
Cleo Avatar asked May 12 '16 14:05

Cleo


1 Answers

Try to change settings on Windows 7 and Windows 8 to 100%. I don't think that it's a Windows 10 problem. Probably that's because default settings in Windows 10 are different.

You can try to "play" with AutoScaleMode Enumeration.

Try to set the mode for the form to None or to Dpi like described here:

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

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

like image 99
Alexej Sommer Avatar answered Sep 27 '22 23:09

Alexej Sommer