Label controls are typically used to provide descriptive text for a control.
For example: To inform the user about the type of data expected in the control, we can use a Label to add descriptive text for a TextBox control.
Label controls can also be used to add descriptive text to a form in order to provide useful information to the user.
For example: We can add a Label to the top of a Form that provides the user with instructions on how to input data in the form controls.
Label controls can also be used to display runtime information about an application's status.
For example: To display the status of each file as a list of files is processed, we can add a Label control to a form. A Label participates in a form's tab order, but does not receive focus.
For example: if the UseMnemonic property is set to true, and a use mnemonic character ( "A mnemonic is an underlined alphanumeric character, typically appearing in a
menu title, menu item, or the text of a button or component of the user interface. i.e. the first character after an ampersand (&) - is specified in the Text property of the
control" ). So when a user presses ALT+ the mnemonic key, then focus moves to the next control in the tab order. This feature provides keyboard navigation for a form. In
addition to displaying text, the Label control can also display an image using the Image property, or a combination of the ImageIndex and ImageList properties.
For example: We can use labels to add descriptive captions to text boxes, list boxes, combo boxes, and so on. We can also write code that changes the text displayed by a label in response to events at run time.
Another For example: If your application takes a few minutes to process a change, you can display a processing-status message in a label.
Note: A Label can be made transparent by setting its 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 Label background might paint improperly.