Home > Articles > Programming > Windows Programming

  • Print
  • + Share This
This chapter is from the book

This chapter is from the book

DesignerAttribute

To specify the designer for a control, the System.ComponentMode.Design.DesignerAttribute is used to decorate the control class. The word decorate is used to denote the fact that the DesignerAttribute provides extra information about the control class. The control class itself does not use the specified designer class; however, VS .NET uses this information to locate and create the specified designer. In the case of the IconButton, the DesignerAttribute would be declared as shown here:

1: [
2: System.ComponentModel.Design.Designer ( 
3:         typeof( SAMS.ToolKit.Design.IconButtonDesigner )
4:                    ) 
5: ]
6: public class IconButton : ... { //rest of class }

The declaration for the designer assumes that the IconButtonDesigner resides in the namespace SAMS.ToolKit.Design and uses the fully qualified name as the argument for the DesignerAttribute. In C# it's not necessary to include the Attribute part when declaring and using an attribute; the class DesignerAttribute can be referenced as Designer.

  • + Share This
  • 🔖 Save To Your Account