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

# TCustomLabel.CalculateSize

Gets the height and width needed for the label text.

## Declaration

Source position: stdctrls.pp line 1575

`protected procedure TCustomLabel.CalculateSize(`
`MaxWidth: Integer;`
`var NeededWidth: Integer;`
`var NeededHeight: Integer`
`);`

## Arguments

`MaxWidth` |  | Maximum width for the text rectangle in the label.
`NeededWidth` |  | Width needed for the text.
`NeededHeight` |  | Height needed for the text.

## Description

Calculates the size for the label text using the formatting defined in related property values.

NeededWidth and NeededHeight are variable parameters updated in the method to reflect the values needed after applying DrawText flags to the label text. The DrawText flags include constants which represent the following properties:

- WordWrap
- HasMultiLine
- ShowAccelChar
- UseRightToLeftReading

The following constants are also used in the DrawText flags:

- DT_CALCRECT
- DT_EXPANDTABS
- DT_NOCLIP