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

# TCustomScrollBar.CalculatePreferredSize

Gets the preferred size for new instances of the class.

## Declaration

Source position: stdctrls.pp line 98

`protected procedure TCustomScrollBar.CalculatePreferredSize(`
`var PreferredWidth: Integer;`
`var PreferredHeight: Integer;`
`WithThemeSpace: Boolean`
`); override;`

## Arguments

`PreferredWidth` |  | Preferred width calculated for the control.
`PreferredHeight` |  | Preferred height calculated for the control.
`WithThemeSpace` |  | True when space is reserved for theme element details in the calculated dimensions.

## Description

CalculatePreferredSize is overridden in TCustomScrollBar. The inherited method is called, and the value in PreferredHeight or PreferredWidth is updated, based on the value in Kind, to use the corresponding value from GetSystemMetrics.

## See also

TCustomScrollBar.Kind |  | Contains the scrollbar orientation, horizontal or vertical.
TWinControl.CalculatePreferredSize |  | Override this method to return a different preferred height and/or width for auto-sizing.
GetSystemMetrics |  | Retrieves various system metrics.