Search code examples
c++winapigdidpi

gdiScaling: can be disable for a specific child window?


I have enabled the gdiScaling option to my MFC C++ application using manifest. However I have a specific internal child window drawn with GDI that has some glitches and performance issues. Can the "advanced" gdiScaling can be disabled for this specific internal child window only, and restore the "classic" low-quality rescale (but keep the rest properly rescaled)?

PS: gdiScalign is enabled as described in https://blogs.windows.com/windowsdeveloper/2017/05/19/improving-high-dpi-experience-gdi-based-desktop-apps/


Solution

  • You could try to use SetDialogDpiChangeBehavior and SetDialogControlDpiChangeBehavior to opt a specific window in a dialog (or the entire dialog itself) out of DPI scaling functionality.

    For more details, you could refer to the link: https://blogs.windows.com/windowsdeveloper/2017/04/04/high-dpi-scaling-improvements-desktop-applications-windows-10-creators-update/

    There are scenarios where you’ll want control over how Windows DPI scales dialogs or even children HWNDs of a dialog. When you want to opt a dialog or an HWND in a dialog out of automatic DPI scaling you can use SetDialogDpiChangeBehavior/SetDialogControlDpiChangeBehavior, respectively.