An Introduction to Controls

An Introduction to Controls

Many types of controls are used to create Windows Forms applications. Some of these controls are complex, such as the tree view and list view controls. Others are simpler and more fundamental, such as the status bar and push button controls. Whether simple or complex, all controls share a set of common properties that can be manipulated to affect the controls’ appearance and behavior. In addition, each control raises events to notify you that an interesting thing has occurred inside the control.

All Windows Forms controls are derived from the Control class. This class includes all Windows Forms components that present a user interface, including the Form class. The Control class includes a basic implementation of many properties, events, and methods that are common to all controls. In fact, most of the properties and events discussed in this chapter are defined in the Control base class.

Because Control is an abstract class, you can’t create an instance of it directly. Instead, we’ll start this chapter by looking at a simple, yet very common, set of controls: the button classes.



Part III: Programming Windows Forms