In Visual Studio .NET, the Windows Forms Designer is central to building Windows applications. Although it is possible to build Windows Forms programs with non-visual coding alone, it is much easier to use the Designer, not only because it makes laying out the contents of forms much simpler, but also because it provides a very rich user interface for specifying controls’ properties. The IDE provides the same quality of user interface for user-designed controls as it does for the built-in controls. Although this design-time support is mostly automated, a little extra effort can greatly enhance the way in which your control is presented in the Designer.
In this chapter, we will look at how to extend our controls so that they integrate fully with the Forms Designer, either by modifying their behavior at design time, or by writing a custom designer class. We will examine the way in which controls and designers interact with Visual Studio .NET. Finally, we will see how to write an extender provider, a component that can augment the capabilities of any control on a form.
There are two contexts in which controls have to operate: design time and runtime. Design time refers to when the control is being displayed in the Forms Designer. Runtime simply means normal execution of a program that uses the control.
Controls do not need to provide any explicit support to allow the Forms Designer to host them. As we saw in Chapter 5, even ...