Custom Controls Design Time Support Part 9: Introducing the Designer

by Amr Elsehemy 20. January 2008 00:55

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.

What is a Designer Capable of?

  1. Filtering Properties in a control.
  2. Add commands in the control context menu during design time.
  3. Adding a smart tag to the control.
  4. much more...

Designer Hierarchy

Desginer 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.

[Designer(RoundButtonDesigner)]
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.

Currently rated 5.0 by 6 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , , ,

Design Time Support

Comments

Add comment


(Will show your Gravatar icon)  

  Country flag

biuquote
  • Comment
  • Preview
Loading



Powered by BlogEngine.NET 1.4.5.0
Theme by Mads Kristensen

About the author

Amr Elsehemy
MCSD C#.Net,
MCTS Sql 2005,
MCPD Enterprise
avatar
E-mail me Send mail

Calendar

<<  August 2008  >>
MoTuWeThFrSaSu
28293031123
45678910
11121314151617
18192021222324
25262728293031
1234567

View posts in large calendar

RecentPosts