0 out of 1 rated this helpful - Rate this topic

Label.TextAlign Property

Gets or sets the alignment of text in the label.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

[LocalizableAttribute(true)] 
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)

Not applicable.

Property Value

One of the ContentAlignment values. The default is TopLeft.
Exception typeCondition

InvalidEnumArgumentException

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 Server 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 Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0
Did you find this helpful?
(1500 characters remaining)

Community Additions

ADD
© 2013 Microsoft. All rights reserved.