Jump to content
Sign in to follow this  

Why does the form size change? (Delphi 11)

Recommended Posts

Given a simple VCL project with an empty VCL form with only the following properties changed from the default:


ClientHeight = 200

ClientWidth = 200

Scaled = False

The dfm looks like this:

object Form2: TForm2
  Left = 0
  Top = 0
  Caption = 'Form2'
  ClientHeight = 200
  ClientWidth = 200
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -12
  Font.Name = 'Segoe UI'
  Font.Style = []
  Scaled = False
  PixelsPerInch = 96
  TextHeight = 15

and the following code:

  TForm2 = class(TForm)
    procedure Loaded; override;

  Form2: TForm2;


{$R *.dfm}

procedure TForm2.Loaded;
  Caption := Format('%dx%d', [ClientWidth, ClientHeight]);

The project's manifest is configured for auto generate, runtime themes enabled and Per Monitor v2 DPI awareness.


I would have expected the form to show with a Caption of '200x200' regardless of screen resolution or DPI.

But I get this:


And the form has indeed these dimensions.

But why? Even if some scaling took place, I would have expected a client width of 300 rather than 618


This is Delphi 11 with Patch 1 applied.


That's the latest oddity which is driving me crazy.

Share this post

Link to post
2 minutes ago, Lajos Juhász said:


Great, just what I need. GExperts for Delphi 11 just got pushed further into the future. I'm really despairing with this high DPI stuff. Maybe I should just give up and wait for 11.1. There are more fun things to do with my spare time than trying to somehow work around all those bugs in Delphi 11.

  • Sad 1

Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this