0

we have a quite old application that is based on Microsoft Access. Parts of the UI are still Microsoft Access, other parts use WinForms and the newest parts use WPF (trying to get rid of the old parts step by step).

We discovered an odd scaling problem in Windows 10 and a high DPI monitor and now I'm looking for a cure for this problem, preferrably one that's not involving changing the old UI.

To be able to work on this high DPI monitor Windows's scaling should be set to 200%.

And here's the problem: When the user logs in with the scaling set to 200% starting our application results in strings that use a too big font for the space the string is placed in. It looks like Windows increased the font size of the strings but not the dimensions of the controls containing the strings. Changing the scaling of Windows doesn't fix the problem, restarting our application after changing the scaling doesn't fix the problem.

Although... when the user logs in with the scaling set to 100% everything is fine, even when changing the scaling afterwards or restarting the application.

But we can't and won't tell our users to always set the scaling of Windows back to 100% when logging off and increasing it again when logging in.

Isn't there an other way to get around this problem?

Thanks for your help (if there is any).

Nostromo
  • 1,177
  • 10
  • 28
  • Making an app dpiAware is work. Overdue work, usually, the older the app the less likely the programmer paid attention to scaling problems. Having WPF in the app made it worse, it automatically declares the app to be dpiAware when it actually is not. Quickest "fix" is to stop it from doing so, add [assembly: System.Windows.Media.DisableDpiAwareness] to your code. You might not like the result too much, you'll have to roll up your sleeves to make it better. – Hans Passant Jun 02 '17 at 12:08
  • [target the app to 4.7 and make the changes that I posed here](https://stackoverflow.com/a/43808350/1466046), now the winforms part is also DPIaware and should fix the issue – magicandre1981 Jun 02 '17 at 15:10

1 Answers1

0

After a little bit of googling I found a solution at least for my special problem.

Microsoft Access had a manifest file with a dpiAware node set to true. Changing that to false seems to tell Access to not use Microsoft's "intelligent" scaling and use some kind of "dumb" scaling instead. This fixed the whole problem for me.

As far as I know one can create such a manifest file for any executable to fix that problem with older applications, but I didn't try that because Access was shipped with an already existing manifest file.

Nostromo
  • 1,177
  • 10
  • 28