RRUZ / vcl-styles-utils

Extend and improve the Delphi VCL Styles
https://theroadtodelphi.wordpress.com/
329 stars 115 forks source link

Form caption bar too small with High DPI #205

Open ronaldruijs opened 7 years ago

ronaldruijs commented 7 years ago

Vcl Styles Basic Demo (Demo App).zip Hello,

Refer to attached zip file. It contains your basic demo, modified to be DPI Aware, by adding a manifest. Everything works OK, except for the window caption, which is too small. Am I overlooking something?

Best regards,

Ronald

pyscripter commented 6 years ago

Same problem with styled applications produced by Delphi 10.2x and having the DPI aware project option checked.

pyscripter commented 6 years ago

Lack of support of DPI aware applications is by far the most serious limitation/bug of VCL Styles. I have created a fix which I would like to contribute to the vcl-styles-utils project.

VCL.Styles.DPIAware.pas

To use the unit just add it to the implementation uses statement of the main form and add the following code to the FormCreate handler.

procedure TFrmMain.FormCreate(Sender: TObject);
Var
  StyleDPIAwareness : TStyleDPIAwareness;
begin
  StyleDPIAwareness := TStyleDPIAwareness.Create(Self);
  StyleDPIAwareness.Parent := Self;

By default the component scales the styles at multiples of 100%. You can change that, by adding the line: StyleDPIAwareness.RoundScalingFactor := False; With this statement styles are scaled to whatever scaling factor results for Screen.PixelsPerInch. Most of the styles would work fine, but a few may show some visual defects.