Skip to content
This repository has been archived by the owner on Jan 13, 2023. It is now read-only.

mntone/Windows.PerMonitorDpiSupport

Repository files navigation

Per-monitor DPI Support Library

NuGet Downloads License

This library includes class Window that handles Per-monitor DPI.

How to

Required

  1. Add app.manifest to a project.

  2. 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>

Better

  1. Open App.config.

  2. 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>

Behaviors

Case #1: Change settings

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).

Case #2: Move window

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)

Case #3: Resize window

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.

License

Under MIT license.

Contact

mntone (name: monotone): reply to @mntone directly

About

Per-monitor Dpi Support Library gives the window that supports Per-monitor DPI.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published