I have a C # program that uses both winforms and WPF, and I'm struggling to get it working in high DPI environments. Currently, if I remove all WPF projects from the solution and run it, it will scale accurately, however, as soon as I add any wpf back (necessary for functions), the scaling will fail and the user interface will become unusable.
This seems to be the same problem as previous SO questions: DPI extension in .Net 3.5 in mixed WinForms and WPF applications and Problems with WinForms properly scaled using DPI
I followed the advice on these issues and tried to add a manifest file and the provided dpi-enabled code.
I also upgraded the project to .NET Framework 4.6.1 (from 4.0) and enabled the app.config parameter: <add key="EnableWindowsFormsHighDpiAutoResizing" value="true" />
This affected the main shell of the program (therefore, instead of loading in a small window with all the control tools, the main program window opens maximized and appears normally). However, when I enter any subform or winforms plugin from the Main window, scaling is not performed.
When I enter any WPF subform or plugin or return to the main screen, they are displayed correctly. Only winforms functions cannot scale properly.
Has anyone got any ideas on how to get mixed winforms / WPF projects to scale correctly in high DPI?
Thanks in advance
Anya hop
source share