Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/emoacht/wpfmonitoraware
A library for Per-Monitor DPI aware and color profile aware Window
https://github.com/emoacht/wpfmonitoraware
color-profile dpi-awareness monitor-dpi
Last synced: about 1 month ago
JSON representation
A library for Per-Monitor DPI aware and color profile aware Window
- Host: GitHub
- URL: https://github.com/emoacht/wpfmonitoraware
- Owner: emoacht
- License: mit
- Created: 2014-06-06T14:33:50.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2023-10-24T19:25:31.000Z (about 1 year ago)
- Last Synced: 2023-10-24T20:34:17.119Z (about 1 year ago)
- Topics: color-profile, dpi-awareness, monitor-dpi
- Language: C#
- Homepage:
- Size: 3.29 MB
- Stars: 31
- Watchers: 9
- Forks: 9
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# WPF Monitor Aware Window
A library for WPF Per-Monitor DPI aware and color profile aware window
## Overview
The introduction of Per-Monitor DPI for WPF is roughly divided into two phases:
1. Per-Monitor DPI was first brought in Windows 8.1. It works with WPF but there is no built-in support for WPF.
2. Built-in Per-Monitor DPI support for WPF was added in .NET Framework 4.6.2 on Windows 10 Anniversary Update (Redstone 1). It includes [DpiScale](https://docs.microsoft.com/en-us/dotnet/api/system.windows.dpiscale) struct which represents DPI scale information and relevant methods and events.
Reference:
- [Microsoft/WPF-Samples/PerMonitorDPI](https://github.com/Microsoft/WPF-Samples/tree/master/PerMonitorDPI)
- [Developing a Per-Monitor DPI-Aware WPF Application](https://docs.microsoft.com/en-us/windows/win32/hidpi/declaring-managed-apps-dpi-aware)## New Phase
### MonitorAware
Implementation __after__ built-in support for WPF was added. It is designed to provide additional flexibilities for composing views under Per-Monitor DPI.
In the application manifest, DPI awareness must be specified:
```xml
true/PM
PerMonitorV2, PerMonitor
```
### WpfMonitorAwareBehavior
Sample for implementation by Behavior.
### WpfMonitorAwareProperty
Sample for implementation by attached property.
### SlateElement
Components for DPI-aware window designed after Windows 10 style. It is required for MonitorAware to avoid inconsistent DPI scaling in non-client area but it works independently from MonitorAware.
### WpfSlateWindow
Sample for SlateElement.
### WpfExtendedWindow
Experimental DPI-aware window designed after Windows 8.1 style.
## Old Phase
### MonitorAware.Old
Original implementation __before__ built-in support for WPF was added. It includes following 3 types:
| Type | Description |
|----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| MonitorAwareWindow | Per-Monitor DPI aware window. |
| MonitorAwareBehavior | Behavior to make a window Per-Monitor DPI aware. This behavior is inherited from System.Windows.Interactivity.Behavior and so requires System.Windows.Interactivity.dll. |
| MonitorAwareProperty | Attached property to make a window Per-Monitor DPI aware. |Properties:
| Property | Description |
|------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| WindowHandler.IsPerMonitorDpiAware | Whether current process is Per-Monitor DPI aware. |
| WindowHandler.SystemDpi | System DPI. This value is used by default to render a Window and other FrameworkElements and so will be the starting point to adjust scaling of FrameworkElements that are once rendered. |
| WindowHandler.MonitorDpi | Per-Monitor DPI of the monitor to which a Window belongs. This value will be updated when the Window receives WM_DPICHANGED message. |
| WindowHandler.WindowDpi | Per-Monitor DPI to be used to render a Window. This value will be conformed to Per-Monitor DPI of the monitor when the Window moves to a location where the resized Window belongs to the destination monitor but not the source monitor. There will be a time lag between when WM_DPICHANGED message comes and when this value changes depending on the location of the Window. |
| WindowHandler.ColorProfilePath | Color profile path used by the monitor to which a Window belongs. |
| WindowHandler.ForbearScaling | Whether to forbear scaling. |
| WillForbearScalingIfUnnecessary | Whether to forbear scaling if it is unnecessary because built-in scaling is enabled. |Events:
| Event | Description |
|-----------------------------------|-----------------------------------------------------------|
| WindowHandler.DpiChanged | Occurs when the WindowDpi is conformed to the MonitorDpi. |
| WindowHandler.ColorProfileChanged | Occurs when the ColorProfilePath is changed. |## License
- MIT License