Windows Forms 2.0 Programming (Microsoft .NET Development Series)

A control is a reusable class that derives from the System.Windows.Forms.Control base implementation (either directly or indirectly) and whose main purpose in life is to interact with users on behalf of a container, which can be either a form or a container control.1 [1] A control's user interaction takes two forms: acceptance of user input via mice and keyboards, and presentation of processing results and state as UI output.

[1] See Chapter 4: Layout for further discussion on container controls.

System.Windows.Forms.Control itself derives from System.ComponentModel.Component, which is great news for you because it provides all the design-time capabilities that components enjoy (as you saw in Chapter 9) and paints a UI right on the container's surface.

In addition to presenting a UI at run time, controls need to present a UI at design time to aid developers in form composition. All controls are composed on a part of the VS05 Windows Forms Designer aptly known as the visual design surface, shown in Figure 10.1.

Figure 10.1. Components Versus Controls in the Windows Forms Designer

After they are on the form, you can proceed to configure controls in exactly the same fashion as you configure components; although with controls, you can see the results immediately.

Категории