DesignerAttribute

function OpenWin(url, w, h) { if(!w) w = 400; if(!h) h = 300; window.open(url, "_new", "width=" + w + ",height=" + h + ",menubar=no,toobar=no,scrollbars=yes", true); }

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.



    .NET Windows Forms Custom Controls
    User Interfaces in VB .NET: Windows Forms and Custom Controls
    ISBN: 1590590449
    EAN: 2147483647
    Year: 2002
    Pages: 74

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net