Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HighDPI problem: size of controls do not resize correctly when ... #14

Open
0ric1 opened this issue Aug 22, 2019 · 9 comments
Open

HighDPI problem: size of controls do not resize correctly when ... #14

0ric1 opened this issue Aug 22, 2019 · 9 comments

Comments

@0ric1
Copy link
Contributor

0ric1 commented Aug 22, 2019

moving the dialog (resizablelib\ResizableDialog) demo application (e.g. dialog New features or Test Dialog) 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.

@ppescher
Copy link
Owner

Could you please post a picture showing this issue?

@0ric1
Copy link
Contributor Author

0ric1 commented Aug 22, 2019

100% Monitor:
20190822_Resizable_HighDPI_Problem2

150% Monitor:
20190822_Resizable_HighDPI_Problem3

The buttons are very tall, not visible in the small preview.

@ppescher
Copy link
Owner

Ok I can see what happens... the dialog controls keep their size in pixels when moving from the 150% monitor to the 100% monitor, while the dialog window itself is shrinked.
Do they stay that size even if you resize the parent window?

@0ric1
Copy link
Contributor Author

0ric1 commented Aug 22, 2019

I shot a hand photo it's more obvious:
Unbenannt

@0ric1
Copy link
Contributor Author

0ric1 commented Aug 22, 2019

Yes, when resized the buttons keep the same size.

@ppescher
Copy link
Owner

Obviously the library does not cope with different DPI settings. I am not sure if there could be a simple fix, like working with "logical" vs "physical" pixels and just call unit conversion functions over window coordinates/size.

@0ric1
Copy link
Contributor Author

0ric1 commented Aug 23, 2019

There are new functions like GetDpiForWindow, GetDpiForSystem, AdjustWindowRectExForDpi, GetDialogControlDpiChangeBehavior, GetDpiFromDpiAwarenessContext, LogicalToPhysicalPointForPerMonitorDPI, PhysicalToLogicalPointForPerMonitorDPI a.s.o. as described here: https://docs.microsoft.com/en-us/windows/win32/hidpi/high-dpi-desktop-application-development-on-windows

@ppescher
Copy link
Owner

It might be possible to support the new API, but I don't have Windows 10 on my main dev PC, so don't expect this change to come any time soon. :-(

@irwir
Copy link
Contributor

irwir commented Oct 14, 2019

According to docs, MFC supports only DPI System-awareness level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants