What is a Designer?
Designers are objects that have the ability to modify a component’s design time behavior on a
design surface. A designer can display a component’s user interface as well as allow property
changes to the component. It can also provide other services and perform additional processing
specific to the component it is associated with. [more]
What is a Designer Capable of?
- Filtering Properties in a control.
- Add commands in the control context menu during design time.
- Adding a smart tag to the control.
- much more…
Designer Hierarchy
Any .Net designer will have to implement the System.ComponentModel.Design.IDesigner interface, two other Interfaces that extend the IDesigner are the IRootDesigner and the ITreeDesigner.
IRootDesginer : It indicates the root designer. A root designer is simply
a top-level designer for other designers.
Ofcourse windows controls are totally different than web controls, as the first ones paints pixels and the other renders HTML, so the designers too are different. There are 3 main Root Designers, one for Web designer System.Web.UI.Design.WebFormsRootDesigner , one for a Windows designer System.Windows.Forms.Design.DocumentDesigner which is the base for Windows Forms and User Controls, and the last one appears when building other controls System.Windows.Forms.Design.ComponentDocumentDesigner.
ITreeDesigner : Provides support for building a set of related custom designers.
No one will ever need to implement this interface for your Designers, all designers can use the base System.ComponentModel.Design.ComponentDesigner which is the base Designer for all web and all windows designers.
The HtmlControlDesigner is the most suitable base class for any web control designer.
The System.Windows.Forms.Design.ControlDesigner is the most suitable base class for any windows control designer.
As always to attach a Designer to the control you need use an Attribute.
[code:c#]
[Designer(RoundButtonDesigner)]
public class RoundButton : Button
[/code]
So next parts I will show common designer features for both web and windows controls, then show web only and windows only designer features.
Leave a Reply