Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual bug in Windows title bar with VCL Styles enabled application and display scaling

Currently I am testing various aspects of VCL styles enabled applications.

I noticed, that with Windows scaling higher than the default 96 dpi/100%, the icon and the title bar text of the VCL Form are too big in size - and both are to close together -, please see attached screenshots. This is especially true with higher scalings like 200% or 250% (e.g. used on 4K displays and Windows 10), but even with a scaling of 144 dpi/150%, the problem is already visible.

This is true for all styles delivered with RAD Studio. High Dpi awareness for manifest is enabled via project settings. If I disable VCL Styles in the App, the icon and title bar text is correct in size.

Am I missing something here? Shouldn't the delivered styles work without such display errors out of the box with display scaling enabled? Or is there some setting somewhere I can adjust to fix this.

Thanks,

enter image description here enter image description here

like image 478
Tom Major Avatar asked Dec 19 '16 18:12

Tom Major


2 Answers

Ok, here is my solution for the visual bugs, please see the attached screenshots. I did fixes in 3 places in Vcl.Forms.pas.

The first fix, commented with // Title bar fix 1, addresses the problem that the icon is not correctly drawn, even without scaling, on a default 96dpi Windows with a VCL styled application. I could fix this based on the findings about WM_GETICON, ICON_SMALL2, from James Johnston, https://stackoverflow.com/a/35067909 thanks, James, for that!

The other two fixes address the problem that the icon is drawn too big with display scaling enabled, and that the distance between the icon and the title bar text is too small. These are the fixes commented with // Title bar fix 2 and 3 in the code. GetDpi is just a getter for the current dpi value, which I get from my C sources within the application.

The result is in no way perfect, but it will do for now, with this the VCL styled application is at least acceptable under scaled circumstances.

Thanks to all for your input.

left original, right 'fixed'

Title bar fix 1

Title bar fix variables

Title bar fix 2

Title bar fix 3

like image 75
Tom Major Avatar answered Nov 07 '22 22:11

Tom Major


VCL Styles do not properly support high DPI scaling.

If you use VCL Styles, then you should remove high DPI awareness from your application manifest.


QP report requesting general high DPI support for VCL Styles: VCL styles don't scale properly under high DPI configurations

Related QC Report for NC area: Styled form's non-client area incorrectly scaled under High DPI

like image 11
Dalija Prasnikar Avatar answered Nov 07 '22 21:11

Dalija Prasnikar