fix(msstyleEditorSharp): add support for improved DPI awareness on newer systems #129
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
The above changes added very simple DPI awareness which was introduced with Windows Vista. Because no other awareness was specified, all later systems will use this DPI awareness which scales GUIs as blurry bitmaps and will not update scaling when moved to a monitor with a different DPI.
Solution
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
to<dpiAware "http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/pm</dpiAware>
for the best legacy support.<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor, System, unaware</dpiAwareness>
.<gdiScaling xmlns="http://schemas.microsoft.com/SMI/2017/WindowsSettings">true</gdiScaling>
to allow WinForm's GDI+ backend to be DPI-aware.Because WinForms uses GDI+ to draw GUIs, we may need to enable GDI Scaling (only works on Windows 10 (1703) and later).
Since Windows Vista,
<dpiAware>true</dpiAware>
sets DPI awareness level to "system". According to the table under Per-Monitor and Per-Monitor (V2) DPI Awareness, system-level awareness means "All displays have the same DPI (the DPI of the primary display at the time the current user session was started)". The application will scale to the DPI of the Primary display. When the DPI is changed (whether it be that of the Primary display or because the window was moved to another display), Windows will scale the application via "bitmap-stretching", causing blurring.Windows 8.1 introduced a (very simple) per-monitor DPI awareness level that could be set via
<dpiAware>per monitor</dpiAware>
or (allows pre-8.1 Windows to use system-awareness)<dpiAware>true/pm</dpiAware>
.Windows 10 (1607) introduced a new element, dpiAwareness. When this element is present, the dpiAware element is ignored. The values allowed for this element were equivalent to dpiAware's values until Windows 10 (1703) added the value "PerMonitorV2".