Standard Controls

The basic unit of the user interface in WinForms is the control. Everything that interacts directly with the user in a region defined by a container is an instance of an object that derives, directly or indirectly, from the System.Windows.Forms.Control class.

Non-Container Controls

Non-container controls are those that don't contain other controls.

Label

The Label control, shown in Figure D.13, holds literal text that is meant to be informative to the user. For example, in a typical application, labels are displayed near text boxes to inform the user what the text box contains. Text inside a label wraps to the width of the label. The label text can be aligned to any side or corner of the control.

// Label
label1.Text = "This ...

Get Windows Forms Programming in C# now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.