I have a C# program that uses both winforms and WPF and I'm struggling to get it to work in high DPI environments. Currently, if I remove all WPF projects from the solution and run it, it will scale fine, however as soon as I add any wpf back in (necessary for the functionality) the scaling fails and the UI becomes unusable.
This seems like the exact same issue as previous SO questions: DPI Scaling in .Net 3.5 in Mixed WinForms and WPF Application and Problems getting WinForms to scale correctly with DPI
I followed the advice on these questions and tried adding a manifest file and the dpi aware code provided.
I also upgraded the project to .net framework 4.6.1 (from 4.0) and included the app.config setting: <add key="EnableWindowsFormsHighDpiAutoResizing" value="true" />
This did affect the main shell of the program (so instead of loading up in a small window with all the controls squished, the main program window opens maximised and appears normal) However, when I enter any winforms subform or plugin from the main window, the scaling fails.
When I enter any WPF subform or plugin, or return to the main screen, these render correctly. It is only the winforms features that are failing to scale properly.
Has anyone got any ideas on how to get mixed winforms/WPF projects to scale correctly in high DPI?
Thanks in advance