3

I am having issues with some applications (mainly dashboard) that some user uses windows display scaling to make their icons bigger but this cause huge problems in my software. I am looking for a way to disable completely the scaling on my application and leave the application scaled to the pixels of the display resolution instead.

I have found this thread but it is 8 years old and windows 10 didn't exist at the time and another user gave an answer but it doesn't work either.

A simple example of the behavior happen mostly on dashboards as there is a lot of controls and widget on these kind of screens and they are critical for thing like robot machinery controller.

One example dashboard window is in it's minimum possible size 1900 x 980 (could be 4-5 pixel smaller in both direction but we rounded up to get rounded positions XY values). This resolution is just shy of 1920 x 1080. It Cannot be smaller but you can make it larger if you have a bigger screen like 4K and all you gain is more date in treeviews, better display in the 3d Engine renderer etc.

So some users have small laptop screen such as 15 inches that have a maximum resolution of 1920 x 1080 resolution but they use 150% scaling so my screen minimum size become 2850 x 1470 in their screen which make the application bigger than the screen and goes outside the screen.

An another example if i use a Windows Surface Pro which have a 2736 x 1824 resolution which is about 80% bigger than 1920 x 1080 the window does indeed still take the original 1900 x 980 pixels on the screen which make it look quite small so if you full screen it you see much more information in all controls. But then if you change scaling to 150% the screen now take again 2850 x 1470 pixels on the screen which is fitting perfectly on the height but on the width i am short by 100 pixels, and 100 pixels that's enough to loose the right part of my screen and you either cannot see the left most part or the right most part of the screen.

I tried the 3 auto scaling mode : DPI, Font and None and it doesn't work at all. It still stretch the screen no matter what. Changing the font of the forms doesn't help either, i manage to make it once work for few labels directly in the form but anything inside group box fail to change or grow twice in size compare to the rest.

Important points :

  • Project are .net 4.5 and 4.6 but there is no problem compiling them in 4.7if i need to for specific features.
  • WPF is out of the question. We took 3 years to implement it and ended up quickly with very bad performance with third party DLL and 3D Cad performance were simply abysmal.
  • Screens are already optimized with the least amount of controls possible. out of the couple hundreds of screen and thousands of user controls about half of them are very close to the limit of 1920 x 1080 which is around 90% of our clients
  • I have received a suggestion of running a Virtual Machine on the client computer with 100% scaling which is not affected by the host computer. It is probably my last resort as it's very difficult to handle dedicated video card through VM especially CAD card such as Quadro and FireGL.
  • Half the users use touch screen and we tried putting everything in a panel with 2 scrollbar and god it's awful and works once in a blue moon. So it's only good for mouse users and these users all have desktop AFAIK so 99% of them doesn't use scaling so they don't have the issue.

So is there anything nowadays that can fix or work around this issue ?

Franck
  • 4,438
  • 1
  • 28
  • 55
  • 2
    You probably don't want to hear this, but I'd consider an app that disrespects my OS-configured scaling to be antisocial to the point that I'd look for alternatives. Many people use this setting because their eyes can't process stuff at smaller sizes. Leaning-in to discern small stuff on a screen can lead to long-term back problems. Don't ignore your users' needs. – spender Aug 09 '18 at 13:45
  • But, do you have `false` in your app.manifest? [From the same "author"](https://stackoverflow.com/questions/13228185/how-to-configure-an-app-to-run-correctly-on-a-machine-with-a-high-dpi-setting-e?answertab=active#tab-top). [Some notes I've written](https://stackoverflow.com/questions/50239138/dpi-awareness-unaware-in-one-release-system-aware-in-the-other?answertab=active#tab-top). – Jimi Aug 09 '18 at 13:58
  • You say no WPF but you're having scaling issues and nothing will fit the bill better. WinForms just isn't the way to go man; the results will be clunky at best. – Michael Puckett II Aug 09 '18 at 14:10
  • A GUI window should be easily resizable, down to a reasonable minimum size. Solve that problem first and you'll solve this one as well. Easier said than done if you previously had the luxury of predictable monitor sizes and resolutions, you've been living on borrowed time. Yes, that's over and won't come back. – Hans Passant Aug 09 '18 at 14:14
  • @Jimi that looks great i'll give it a try. And Hans i do have reasonable minimum size. These window are already packed to the max. I have some drop down list that are 35 pixel wide by 25 pixel high. That is just large enough to have the drop icon and be able to see the first character in the drop list. I cannot make things smaller than that. These dashboard required that much controls that we are working at pixel level to align and save pixel by pixel to fit all in. – Franck Aug 09 '18 at 15:28
  • 1
    @Jimi your extra note part were perfect. Your the only one to specify per OS version and it works for windows 10 too. Even with the extra pixels the form header takes since that is still scaling in just enough that the height of the window still fits perfectly. – Franck Aug 09 '18 at 16:03

1 Answers1

0

Did you try making your Process DPI aware?

You can either do it through a pinvoke:

[System.Runtime.InteropServices.DllImport("user32.dll")]
private static extern bool SetProcessDPIAware();

and call

SetProcessDPIAware();

in your Main or create a Manifest and add

<dpiAware>true</dpiAware>

There is a tutorial here. Declearing it DPIAware should stop windows from scaling by its own.

Hyarus
  • 922
  • 6
  • 14