Windows Forms 2.0 Programming (Microsoft .NET Development Series)
Custom components are a great way to package reusable Windows Forms code that typically doesn't have a UI or handle user input. Creating a custom component is much like creating a standard class, except that components come with built-in resource management and are the cornerstone of the Windows Forms designtime experience. Components are added to the Toolbox in one of two ways: either automatically by VS05 (if a component is located in the current project) or by an extra, manual step to pull in a component from another assembly. Components can be dragged from the Toolbox onto the nonvisual design surface of a form, and that allows them to receive design-time support provided by VS05 and Windows Forms Designer, including property configuration and event handling via the Properties window. Ultimately, the overall productivity and usability of a component are an order of magnitude greater than those of a simple class. When reusable Windows Forms code does need a region of its host container to render a UI and handle user input, like text boxes and labels, it needs to become a control, which you can acquaint yourself with in Chapter 10: Controls. |
Категории