Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Short version: change all form's to <code>AutoScroll = False</code></p> <hr> <p>The problem is the form's <code>AutoScroll</code> property, and how it affects which form size is stored in the DFM.</p> <p>If <code>AutoScroll</code> is <strong>true</strong> (the default) the DFM will store <code>Width</code> and <code>Height</code>: </p> <pre><code>object Form1: TForm1 Left = 192 Top = 114 Width = 544 Height = 375 Caption = 'Form1' ... </code></pre> <p>If <code>AutoScroll</code> is <strong>false</strong> (the <em>preferred</em> setting) the DFM will store <code>ClientWidth</code> and <code>ClientHeight</code>: </p> <pre><code>object frmSplash: TfrmSplash Left = 192 Top = 114 ClientWidth = 536 ClientHeight = 348 Caption = 'Form1' </code></pre> <p>The problem with storing <code>Height</code> is what happens when the user's <em>caption bar</em> is a different size than your development machine, e.g.</p> <ul> <li>you develop on Windows 2000, program runs on Windows XP</li> <li>you develop on Windows XP, program runs on Windows Vista</li> <li>you develop with small fonts, program runs with large fonts</li> </ul> <p>Windows 2000 had a 4 pixel border, with a 23 pixel caption bar. With the DFM storing a <code>Height</code> of 375, this leaves 348px for form client area.</p> <p>Run the same program on Windows XP, which has a taller (28 pixel) caption bar. With the DFM storing a <code>Height</code> of 375 pixels, this leaves 343px for client area.</p> <p>Your form "got 5 pixels shorter".</p> <p>You need to force Delphi to store the <code>ClientWidth</code> and <code>ClientHeight</code> in the DFM by turning <code>AutoScroll</code> off.</p> <p>Now when you create your 348px tall form on Windows XP, it will continue to have 348 pixels in the client area - and be however extra tall is required to have a caption bar.</p> <p>i go so far as to have an <code>OutputDebugString</code> and a breakpoint trigger if my helper library code finds any form that mistakenly has <code>AutoScroll</code> set to <strong>true</strong>.</p> <hr> <p><strong>Edit:</strong> Since i try to be a good developer, i make my form's respect the user's font preference. During the <code>OnCreate</code> of all my forms i call a <code>StandardizeForm(Self)</code> function that:</p> <ul> <li>scales the form to match the user's default font size</li> <li>changes the font on all controls on the form to the user's preference</li> <li>issues an ODS if the form is set mistakenly set to <code>Scaled</code></li> <li><strong>issues an ODS and breakpoint if <code>AutoScroll</code> true (and sets it to false)</strong></li> <li>issues an ODS and breakpoint if <code>ShowHint</code> is false (and turns it on)</li> <li>etc</li> </ul> <p>You can do something similar. Yes you'd have to add:</p> <pre><code>procedure TCustomerEditForm.FormCreat(Sender: TObject); begin StandardizeForm(Self); //Pay your taxes! ... end; </code></pre> <p>But it's worth it for me.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload