[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] Reference for unit 'Forms' (#lcl)

TCustomForm.CalculatePreferredSize

Calculates the clipping width and height for a top-level form on the monitor WorkArea.

Declaration

Source position: forms.pp line 663

protected procedure TCustomForm.CalculatePreferredSize(

  var PreferredWidth: Integer;

  var PreferredHeight: Integer;

  WithThemeSpace: Boolean

); override;

Arguments

PreferredWidth

  

Default width for a new instance of the class.

PreferredHeight

  

Default height for a new instance of the class.

WithThemeSpace

  

True if additional space is reserved for theme element details.

Description

CalculatePreferredSize is an overridden method in TCustomForm. It calls the inherited method on entry to calculate the default dimensions for the new class instance, and to notify the widgetset class when its Handle has been allocated.

CalculatePreferredSize ensures that a form anchored to the bottom or right fits within the WorkArea rectangle on the Monitor. The value in PreferredWidth or PreferredHeight is updated when Anchors contains akRight or akBottom.

See also

TCustomForm.Monitor

  

Contains the Monitor where the form is shown.

TMonitor.WorkAreaRect

  

The usable display area on the monitor excluding the system task bar.

TControl.CalculatePreferredSize

  

Override this method to return the preferred height and width for the control.

TControl.Anchors

  

The set of anchor definitions for this control.


Version 3.2 Generated 2024-02-25 Home