有没有win32窗口自适应高DPI的好方法?
查到了SetProcessDpiAwareness这个函数的三个参数
PROCESS_DPI_UNAWARE DPI unaware. This app does not scale for DPI changes and is always assumed to have a scale factor of 100% (96 DPI). It will be automatically scaled by the system on any other DPI setting.
这个我以为会DWM会帮我放大,发现不行。
PROCESS_SYSTEM_DPI_AWARE System DPI aware. This app does not scale for DPI changes. It will query for the DPI once and use that value for the lifetime of the app. If the DPI changes, the app will not adjust to the new DPI value. It will be automatically scaled up or down by the system when the DPI changes from the system value.
这个是应用启动阶段获取dpi,但是dpi改变后不会通知到软件。总的来说还是靠软件自己解决。
PROCESS_PER_MONITOR_DPI_AWARE Per monitor DPI aware. This app checks for the DPI when it is created and adjusts the scale factor whenever the DPI changes. These applications are not automatically scaled by the system.
dpi改变后会通知到软件,但是需要软件自己解决。