Chapter 5. Windows Forms II: Controls, Common Dialog Boxes, and Menus
By themselves, one or more forms provide very little functionality to most desktop applications. For the most part, forms are valuable insofar as they serve as containers for controls. In this chapter, we’ll complete our discussion of building desktop applications by focusing on the objects that forms contain—in particular, controls and components, common dialogs, and menus.
Common Controls and Components
This section contains a summary of the controls and components defined in the System.Windows.Forms namespace. Components are classes derived from the Component class (defined in the System.ComponentModel namespace). They may or may not provide a visual interface. They are often used as elements of forms but don’t have to be. Controls are classes derived from the Control class (defined in the System.Windows.Forms namespace). Controls generally are used to build the visual appearance of a form. The Control class itself is derived from the Component class, so controls are also components.
The common dialog boxes are not listed here, even though they all derive from the Component class. They are given their own section, Section 5.4 later in this chapter.
The Button Class
This class represents a button control, which is one of the most commonly used controls in Windows applications. The Button class’s Click event, which it inherits from Control, is its most commonly used event.
The Button class inherits two important ...