Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you want your form to not resize at all, then setting the form border style to <code>bsSingle</code> is the right thing to do, as then the mouse cursor will not change to one of the sizing cursors when moved over the form borders, so it is obvious to the user that this form can not be resized.</p> <p>If you want to set a minimum and / or a maximum size for the form, then <code>bsSizeable</code> is the correct border style, and you can use the <code>Constraints</code> of the form to specify the limits. There is however the problem that the <code>Constraints</code> property doesn't prevent the resizing of the form, it only causes the sizes to be adjusted after the fact so that the limits are not violated. This will have the negative side effect that sizing the form with the left or upper border will move it. To prevent this from happening you need to prevent the resizing in the first place. Windows sends the <a href="http://msdn.microsoft.com/en-us/library/ms632626%28VS.85%29.aspx" rel="noreferrer"><code>WM_GETMINMAXINFO</code></a> message to retrieve the minimum and maximum tracking sizes for a top level window. Handling this and returning the correct constraints fixes the moving form issue:</p> <pre><code>type TForm1 = class(TForm) private procedure WMGetMinMaxInfo(var AMsg: TWMGetMinMaxInfo); message WM_GETMINMAXINFO; end; // ... procedure TForm1.WMGetMinMaxInfo(var AMsg: TWMGetMinMaxInfo); begin inherited; with AMsg.MinMaxInfo^ do begin ptMinTrackSize := Point(Constraints.MinWidth, Constraints.MinHeight); ptMaxTrackSize := Point(Constraints.MaxWidth, Constraints.MaxHeight); end; end; </code></pre>
    singulars
    1. This table or related slice is empty.
    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. 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