0

I have a C# project that needs to disable DPI awareness, and does so in the AssemblyInfo.cs using the following code:

[assembly: System.Windows.Media.DisableDpiAwareness]

It works perfectly (I can confirm it has fixed previous DPI resizes) up until it loads the OpenTK dll used for 3D rendering (https://gfycat.com/FamousFantasticCommongonolek). Is there any way (other than rebuilding OpenTK from source myself) that I can properly disable DPI awareness with the DLL?

jazb
  • 5,498
  • 6
  • 37
  • 44
  • 1
    https://stackoverflow.com/questions/13858665/disable-dpi-awareness-for-wpf-application – vasily.sib Nov 27 '18 at 05:18
  • 1
    This setting is just for the `System.Windows.Media` assemblies. Have you disabled DPIAwaress in your `app.manifest`? Directly related, [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) and read [How to configure an app to run correctly on a machine with a high DPI setting](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) (to read *inverted*, of course) – Jimi Nov 27 '18 at 05:18
  • Ah so that's why it only was fixing DPI bugs relating to WPF, makes sense. Thanks, adding the app.manifest fixed the issue! – soopercool101 Nov 27 '18 at 05:35
  • 1
    That has been an ongoing problem as of late, a recent Win10 version (Creator's I think) makes SetProcessDPIAware and friends instantly effective. Older versions required calling it before a window is created. This is desirable, except when programmers don't desire it. You took the sting out of WPF code doing this with the attribute. But this isn't WPF code making the call. It's going to take a while for these library authors to fix their code, be sure to file the bug report. – Hans Passant Nov 27 '18 at 09:06

0 Answers0