Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Handle runtime change of DPI (text size) on Windows 10

On Windows 10, the system no longer requires restart (logoff/logon) to change DPI (text size).

My application is not ready for such a runtime change.

How does system inform an application that the DPI is changing? What message should I handle?


I'm using C++ Builder, so I'm looking for a pure WinAPI solution, no WinForms.

like image 615
Martin Prikryl Avatar asked Jul 29 '15 13:07

Martin Prikryl


1 Answers

Since C++ Builder 10.3 you can use these form events:

  • OnAfterMonitorDpiChanged
  • OnBeforeMonitorDpiChanged

Of course you also need to set DPI Awareness to PerMonitorV2 in the application manifest in the project settings.

like image 169
RobinP Avatar answered Oct 22 '22 09:10

RobinP