This documentation is archived and is not being maintained.

Label.TextAlign Property

Gets or sets the alignment of text in the label.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in

public virtual ContentAlignment TextAlign { get; set; }
/** @property */
public ContentAlignment get_TextAlign ()

/** @property */
public void set_TextAlign (ContentAlignment value)

public function get TextAlign () : ContentAlignment

public function set TextAlign (value : ContentAlignment)

Property Value

One of the ContentAlignment values. The default is TopLeft.

Exception typeCondition


The value assigned is not one of the ContentAlignment values.

You can use this property to align the text within a label to match the layout of controls on your form. For example, if your controls are located to the right edge of the labels, you can set the TextAlign property to one of the right-aligned horizontal alignments (TopRight, MiddleRight, BottomRight) and the text will be aligned with the right edge of the labels to align with your controls.

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0