7

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?

Cleo
  • 620
  • 2
  • 10
  • 32

2 Answers2

5

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.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Alexej Sommer
  • 2,677
  • 1
  • 14
  • 25
  • 3
    Thank you, the AutoScaleMode directed me to the right solution. I have set it to "Dpi" on all forms and now it looks better. One more change required was the Font: I have noticed that our default font, "Microsoft Sans Serif" was presented way bigger on Windows 10 which was also causing problems, so I have changed it to Arial, which has similiar sizes on both Windows 7 and 10. – Cleo May 13 '16 at 08:52
0

I had a similar problem. Certain groupboxes were showing too wide on a Windows Forms application. It worked on a Windows 7 laptop, but not a Windows 10 one.

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

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131