This library includes class Window
that handles Per-monitor DPI.
-
Add app.manifest to a project.
-
Add next:
<?xml version="1.0" encoding="utf-8"?> <assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1"> <application xmlns="urn:schemas-microsoft-com:asm.v3"> <windowsSettings> <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">True/PM</dpiAware> </windowsSettings> </application> </assembly>
-
Open App.config.
-
Add next:
<?xml version="1.0" encoding="utf-8" ?> <configuration> <runtime> <AppContextSwitchOverrides value="Switch.MS.Internal.DoNotApplyLayoutRoundingToMarginsAndBorderThickness=false" /> </runtime> <appSettings> <add key="EnableMultiMonitorDisplayClipping" value="true" /> </appSettings> </configuration>
User can change DPI with using control panel. Then, Windows throw event WM_DPICHANGED
.
In this case, it handles DPI change (monitor DPI) and resize (independence DPI settings).
Users can move Window with clicking caption bar. Then, Windows throw event WM_DPICHANGED
when it detect DPI change.
In this case, it handles DPI change (monitor DPI) and resize (independence DPI settings). (the same as case #1)
User can resize Window with clicking resize border. Then, Windows throw event WMM_DPICHANGED
when it detect DPI change.
In this case, it handles DPI change (monitor DPI) only. It does NOT handle resize.
Under MIT license.
mntone (name: monotone): reply to @mntone directly