Custom Component Designers
Visual Studio .NET enables controls to customize the Forms Designer. New commands can be added in the property grid. Resize and move drag operations can be altered, and mouse handling within the control can be customized. Design-time adornments may be added (adornments are editing features such as resize handles). Hit testing can be provided for nonrectangular controls. Controls may elect to act as containers of child controls. Controls may even modify the way that properties are presented in the property panel. All these facilities revolve around supplying a custom component designer.
A component designer is a class associated with the control class,
whose job is to handle design-time interaction with the development
environment. It must derive from the
which is defined in the
System.Windows.Forms.Design namespace. (In fact,
any component may have a designer, not just a control. A non-visual
component’s designer derives from the
class, which is defined in the
The terminology is unfortunate—there are three designers involved at design time:
The Forms Designer (the visual editing environment provided by Visual Studio .NET for building Windows Forms applications)
The control’s custom designer class
The developer who is designing the form
To avoid ambiguity, in this book, the Forms Designer is always referred to with a capital D. A designer with a lower case D refers to the ...