System.Windows.Forms.Label Class

Represents a standard Windows label.

See Also: Label Members

Syntax

[System.ComponentModel.DefaultBindingProperty("Text")]
[System.ComponentModel.ToolboxItem("System.Windows.Forms.Design.AutoSizeToolboxItem,System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.ComponentModel.Designer("System.Windows.Forms.Design.LabelDesigner, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.ComponentModel.Design.IDesigner")]
[System.ComponentModel.DefaultProperty("Text")]
public class Label : Control

Remarks

System.Windows.Forms.Label controls are typically used to provide descriptive text for a control. For example, you can use a System.Windows.Forms.Label to add descriptive text for a System.Windows.Forms.TextBox control to inform the user about the type of data expected in the control. System.Windows.Forms.Label controls can also be used to add descriptive text to a System.Windows.Forms.Form to provide the user with helpful information. For example, you can add a System.Windows.Forms.Label to the top of a System.Windows.Forms.Form that provides instructions to the user on how to input data in the controls on the form. System.Windows.Forms.Label controls can be also used to display run time information on the status of an application. For example, you can add a System.Windows.Forms.Label control to a form to display the status of each file as a list of files is processed.

A System.Windows.Forms.Label participates in the tab order of a form, but does not receive focus (the next control in the tab order receives focus). For example, if the Label.UseMnemonic property is set to true, and a mnemonic character—the first character after an ampersand (&)—is specified in the Control.Text property of the control, when a user presses ALT+ the mnemonic key, focus moves to the next control in the tab order. This feature provides keyboard navigation for a form. In addition to displaying text, the System.Windows.Forms.Label control can also display an image using the Label.Image property, or a combination of the Label.ImageIndex and Label.ImageList properties.

Note:

A System.Windows.Forms.Label can be made transparent by setting its Control.BackColor property to Color.Transparent. When you use a transparent label, use only the current device coordinate system to draw on the container, or the System.Windows.Forms.Label background might paint improperly.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0