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

# TCustomLabel.Alignment

Horizontal text justification in the control (centered, left- or right-justified).

## Declaration

Source position: stdctrls.pp line 1597

`protected property TCustomLabel.Alignment : TAlignment read FAlignment write SetAlignment default taLeftJustify;`

## Description

Alignment is a TAlignment property which controls the horizontal justification of the text displayed in the control. The default value for the property is taLeftJustify. When a new value is assigned to the Alignment property, the Invalidate method is called to repaint the control.

Alignment (and other properties) are used in the Paint method when the text is rendered to the Canvas for the control. It is also used in UpdateSize when right alignment needs to be considered for an auto-sized or optimal-filled control.

Use the Layout property to control the vertical alignment of the text displayed in the control.

Use OptimalFill to indicate if the font height can be adjusted to fill the client area for the control.

## See also

TCustomLabel.AutoSize |  | Enables or disables auto-sizing the control to its content.
TCustomLabel.Layout |  | Vertical alignment for control text (at the top, bottom, or center).
TCustomLabel.OptimalFill |  | If True, the font size is adjusted for optimal fill of the available space.
TCustomLabel.Paint |  | Performs actions needed to draw the control on its Canvas.
TCustomLabel.UpdateSize |  | Adjusts the size for the control based on settings in AutoSize and OptimalFill.
TControl.Invalidate |  | Causes a delayed Repaint of the control by marking its visible area of the control as invalid.
TAlignment