Share via


Label Control Overview (Windows Forms)

Windows Forms Label controls are used to display text or images that cannot be edited by the user. They are used to identify objects on a form — to provide a description of what a certain control will do if clicked, for example, or to display information in response to a run-time event or process in your application. For example, you can use labels to add descriptive captions to text boxes, list boxes, combo boxes, and so on. You can also write code that changes the text displayed by a label in response to events at run time. For example, if your application takes a few minutes to process a change, you can display a processing-status message in a label.

Working with the Label Control

Because the Label control cannot receive the focus, it can also be used to create access keys for other controls. An access key allows a user to select the other control by pressing the ALT key with the access key. For more information, see Creating Access Keys for Windows Forms Controls and How to: Create Access Keys with Windows Forms Label Controls.

The caption displayed in the label is contained in the Text property. The TextAlign property allows you to set the alignment of the text within the label. For more information, see How to: Set the Text Displayed by a Windows Forms Control.

See Also

Tasks

How to: Size a Windows Forms Label Control to Fit Its Contents
How to: Create Access Keys with Windows Forms Label Controls

Reference

Label Class