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

# TCustomUpDown.CalculatePreferredSize

Calculates the preferred width and height for the control.

## Declaration

Source position: comctrls.pp line 1986

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

## Arguments

`PreferredWidth` |  | Returns the preferred width for the control in pixels.
`PreferredHeight` |  | Returns the preferred height for the control in pixels.
`WithThemeSpace` |  | Not used in the method.

## Description

Returns the preferred width and height (in pixels) for the class instance. The value in Orientation is used to determine the width and height values returned in the PreferredWidth and PreferredHeight arguments.

udHorizontal
  PreferredWidth is set to 31 pixels. PreferredHeight is set to 17 pixels.
udVertical (the default)
  PreferredWidth is set to 17 pixels. PreferredHeight is set to 31 pixels.