Jump to content
Oscar Hernández

VCL Forms with Border Style as bsDialog increase their width and height from Delphi 10.4 to Delphi 12

Recommended Posts

Hello everyone,

I am upgrading my projects from Delphi 10.4 to Delphi 12, and I have noticed that all my forms with BorderStyle set to bsDialog have increased in width and height by 10 pixels. The problem is that some of these forms are configured at runtime using the Width and Height properties, so in Delphi 12, they appear smaller than expected.

Is there a way to prevent this, or any workaround to handle the issue?

Below are some screenshots of a form in Delphi 10.4 with BorderStyle set to bsDialog, compared to the same form opened in Delphi 12.

 

image.thumb.png.a359bc2a6eac9e993e600dbba83053cf.png

 

 

 

 

 

Edited by Oscar Hernández

Share this post


Link to post

Are you using Vcl? Are you using styles?   I can see that in your images the form title bars are styled differently.

 

I don't see that in a simple dialog:

 

image.png.b5b5b675daaf1b90ad367f0889b83102.png

 

Delphi 11:  Client width 269, Width 285

Delphi 12: Same.

Edited by pyscripter

Share this post


Link to post

No, I am not using VCL Styles, the left side is from RAD Studio 10.4 (Sydney) and the right side is from RAD Studio 12.1 (Athens)

This is a VCL Project.

I have noticed that Delphi 12 styles the title bar different from Delphi 10.4

 

Also if the BorderStyle of the form is set to bsSizeable, the size of Client Width and Width are equals on the two IDEs but it changes when the BorderStyle is set to bsDialog. 

 

Form1 with BorderStyle set to bsDialog Delphi 10.4 (Left side) <-> Delphi 12 (Right side)

image.thumb.png.9ab0bef12ce705757017795056139f5d.png

 

Form1 with BorderStyel set to bsSizeable Delphi 10.4 (Left side) <-> Delphi 12 (Right side)

image.thumb.png.3e3cc8ffe8662522ecf279b932eb0fb7.png

 

Can you notice the difference?

 

 

Edited by Oscar Hernández

Share this post


Link to post

Yes I do notice the difference.   However I do not have 10.4 installed to compere.  Delphi 12 behaves the same as Delphi 11 though.

Share this post


Link to post

The manifest of Delphi 10 and 11+ are probably different so Delphi 10 gets the XP window style, while 11+ gets the current window style.

I don't have Delphi 10 installed anymore but if you can post its manifest then we can verify.

 

Apart from that, if you rely on Form.Width/Height this will not only be a problem in the IDE but also at run-time where your application will use whatever windows style the host OS dictate.

Use Form.ClientWidth/ClientHeight instead; Then you don't have to worry about the border width.

  • Like 1

Share this post


Link to post
  On 3/14/2025 at 9:59 PM, pyscripter said:

Yes I do notice the difference.   However I do not have 10.4 installed to compere.  Delphi 12 behaves the same as Delphi 11 though.

Yes, it seems that Delphi 10.4 and Delphi 11+ behave differently in this aspect.

 

Thank you for your responses.

Share this post


Link to post
  On 3/14/2025 at 10:12 PM, Anders Melander said:

The manifest of Delphi 10 and 11+ are probably different so Delphi 10 gets the XP window style, while 11+ gets the current window style.

I don't have Delphi 10 installed anymore but if you can post its manifest then we can verify.

 

Apart from that, if you rely on Form.Width/Height this will not only be a problem in the IDE but also at run-time where your application will use whatever windows style the host OS dictate.

Use Form.ClientWidth/ClientHeight instead; Then you don't have to worry about the border width.

Yes, I think that we are going to change that and rely on ClientWidth/ClientHeight instead of Widht/Height.

 

Here is the Manifest:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
  <asmv3:application>
    <asmv3:windowsSettings>
      <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
      <dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness>
    </asmv3:windowsSettings>
  </asmv3:application>
  <dependency>
    <dependentAssembly>
      <assemblyIdentity
        type="win32"
        name="Microsoft.Windows.Common-Controls"
        version="6.0.0.0"
        publicKeyToken="6595b64144ccf1df"
        language="*"
        processorArchitecture="*"/>
    </dependentAssembly>
  </dependency>
</assembly>

Share this post


Link to post
  23 hours ago, Oscar Hernández said:

Yes, I think that we are going to change that and rely on ClientWidth/ClientHeight instead of Widht/Height.

If you look at the IDE form designer, you can see that that is also what it does; The client size stays the same between the two Delphi versions.

 

  23 hours ago, Oscar Hernández said:

Here is the Manifest:

Yes; It's missing the whole <compatibility> section so it basically gets the Windows XP treatment.

  • Thanks 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

×