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…
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.
public class RoundButton : Button
So next parts I will show common designer features for both web and windows controls, then show web only and windows only designer features.
2 replies on “Custom Controls Design Time Support Part 9: Introducing the Designer”
Thank you for your Custom Control Tut Serie.It has a very high Quality and is very good to understand.
It Helps me a lot and i didn’t find a better tutorial. I searched a lot for this topic and only find snippets..
I hope you’ll make more tuts of this thank you!
Thank you very much for this comment, made my day.
Promise you will like the next parts too.