EnableWindowsFormsHighDpiAutoResizing in MFC native app

122 views Asked by At

MFC application with CLR support enabled (.net framework 4.7.2) that references a c# assembly that contains WinForms controls. These controls use Control.DeviceDpi but at runtime this api always returns 96.

Adding an MFCApplication.exe.config with EnableWindowsFormsHighDpiAutoResizing solves the issue. Control.DeviceDpi reports accurate dpi.

Is there a way to embed this .config in the MFCApplication.exe ? Or could this flag be set programmatically at startup? Are there some best practice in this regard ?

0

There are 0 answers