Label.TextAlign Property

Definition

Gets or sets the alignment of text in the label.

public virtual System.Drawing.ContentAlignment TextAlign { get; set; }

Property Value

One of the ContentAlignment values. The default is TopLeft.

Exceptions

The value assigned is not one of the ContentAlignment values.

Remarks

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.

Applies to

Product Versions
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

See also