ppescher / resizablelib

A set of MFC classes to easily make resizable windows
Other
55 stars 27 forks source link

HighDPI problem: SizeGrip of dialogs vanishes, when ... #13

Open 0ric1 opened 4 years ago

0ric1 commented 4 years ago

moving the dialog (resizablelib\ResizableDialog) demo application from a monitor (main) with 150% scaling to a monitor (secondary) with 100% scaling and the demo application has "Per Monitor High DPI Aware V2" enabled. The application is started from 150% monitor. With the setting "No theme" is is partly visible.

Used Manifest:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- https://docs.microsoft.com/en-us/windows/win32/sbscs/application-manifests -->
<!-- https://blogs.windows.com/windowsdeveloper/2017/04/04/high-dpi-scaling-improvements-desktop-applications-windows-10-creators-update/ -->
<!--   MFC: Although we ve added per-monitor DPI scaling support to Win32, WPF and WinForms, MFC does not natively support this functionality. -->
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">

  <!-- Declare this application as DPI aware and Per-Monitor V2 DPI ready -->
  <application xmlns="urn:schemas-microsoft-com:asm.v3">
    <!-- https://docs.microsoft.com/en-us/windows/desktop/sbscs/application-manifests -->
    <!-- https://stackoverflow.com/questions/46428510/enhanced-system-dpi-scaling-with-vs2017 -->
    <windowsSettings>
        <dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness>
        <!-- Un-comment the line below to enable GDI-scaling in this project. This will enable text -->
        <!-- to render crisply in DPI-unaware contexts --> 
        <!-- <gdiScaling xmlns="http://schemas.microsoft.com/SMI/2017/WindowsSettings">true</gdiScaling> -->
    </windowsSettings>
  </application>

</assembly>
ppescher commented 4 years ago

What version of Windows did you test on? Does it happen also with both monitors having 100% or both 150% scaling settings? If you have Microsoft Spy++, could you check if the sizegrip is still where it's supposed to be? The dialog window should have a Scrollbar child window in its sizing corner. Is this window in the correct position and not showing anything, or is it outside the client area of the parent dialog window?

0ric1 commented 4 years ago

I am on Windows 10 1803 Prof. DE, using Visual Studio 2019 16.2.3 with PlatformToolset v142 and Windows SDK Version 10.0.18362.0. Spy++ did not find the window when moved over the grip, but it does appear in the Windows list as ScrollBar but when using Highlight it does not highlight it. It seems to be in the correct position, because it does appear partially when switching the SizeGrip modus between Visible and Hidden and chaning the Theme Properties.

0ric1 commented 4 years ago
20190822_Resizable_HighDPI_Problem
ppescher commented 4 years ago

Not sure if the Scrollbar control has the correct position and size... it seems not. Could you capture a screenshot of the Spy++ properties window relative to the scrollbar (where rect coord are shown)?

0ric1 commented 4 years ago
20190822_Resizable_HighDPI_Problem4
ppescher commented 4 years ago

Could you show me the Rect coordinates of both the Scrollbar child window and the parent dialog window?

0ric1 commented 4 years ago
20190823_Resizable_HighDPI_Problem6 20190823_Resizable_HighDPI_Problem5
ppescher commented 4 years ago

It seems the sizegrip is not where it should be: for example, the rightmost coordinate is -879, while the dialog rightmost coordinate is -854. That's an offset of 25px horizontally (and 27px vertically), that seems too much to account only for the window border.

Anyway, like I said the library is not "DPI aware" so anything weird can happen.