DekGenius.com
[ Team LiB ] Previous Section Next Section

ControlDesignerdisposable

System.Web.UI.Design (system.design.dll)class

This is base class for web control designers like System.Web.UI.Design.WebControls.AdRotatorDesigner. These designers create the design-time appearance that a control provides to the design editor (like Visual Studio .NET). This HTML code is provided through the GetDesignTimeHtml( ) method, which is called by the host. The base implementation of the GetDesignTimeHtml( ) method invokes the System.Web.UI.Control.Render( ) method of the appropriate control to create the same HTML at design time as at runtime. A custom designer modifies this behavior by overriding the GetDesignTimeHtml( ) to provide HTML that is more suitable for a design-time representation.

You can create your own custom designer to use with a custom System.Web.UI.WebControls.WebControl. In this case, you use the System.ComponentModel.DesignerAttribute on the class declaration of your control to connect it with the appropriate designer. You can set various ControlDesigner properties—the most useful of which is AllowResize, which restricts your control to a fixed size. When your control is resized, the designer will call corresponding methods like OnControlResize( ) to give you a chance to refresh the appearance of your control accordingly. At this point you can call UpdateDesignTimeHtml( ), which instructs the host to call your GetDesignTimeHtml( ) method and refresh the control display with the new content.

The GetDesignTimeHtml( ) method should call GetEmptyDesignTimeHtml( ) if the rendered HTML string is empty (for example, when required control properties are not set). The base implementation of GetEmptyDesignTimeHtml( ) returns the fully qualified name of the control. Alternatively, you may want to override this property to supply a place holder using the CreatePlaceHolderDesignTimeHtml( ). You may also want to override GetErrorDesignTimeHtml( ) method with specific information based on the exception object that is provided.

public class ControlDesigner : HtmlControlDesigner {
// Public Constructors
   public ControlDesigner( );
// Public Instance Properties
   public virtual bool AllowResize{get; }
   public virtual bool DesignTimeHtmlRequiresLoadComplete{get; }
   public virtual string ID{set; get; }
   public bool IsDirty{set; get; }
   public bool ReadOnly{set; get; }
// Protected Instance Properties
   protected object DesignTimeElementView{get; }
// Public Instance Methods
   public virtual string GetDesignTimeHtml( );
   public virtual string GetPersistInnerHtml( );
   public override void Initialize(System.ComponentModel.IComponent component);
             // overrides System.ComponentModel.Design.ComponentDesigner
   public bool IsPropertyBound(string propName);
   public virtual void OnComponentChanged(object sender, 
        System.ComponentModel.Design.ComponentChangedEventArgs ce);
   public void RaiseResizeEvent( );
   public virtual void UpdateDesignTimeHtml( );
// Protected Instance Methods
   protected string CreatePlaceHolderDesignTimeHtml( );
   protected string CreatePlaceHolderDesignTimeHtml(string instruction);
   protected virtual string GetEmptyDesignTimeHtml( );
   protected virtual string GetErrorDesignTimeHtml(Exception e);
   protected override void OnBehaviorAttached( );   // overrides HtmlControlDesigner
   protected override void OnBindingsCollectionChanged(string propName);  // overrides HtmlControlDesigner
   protected virtual void OnControlResize( );
   protected override void PreFilterProperties(System.Collections.IDictionary properties); 
             // overrides HtmlControlDesigner
}

Hierarchy

System.Object System.ComponentModel.Design.ComponentDesigner(System.ComponentModel.Design.IDesigner, System.IDisposable, System.ComponentModel.Design.IDesignerFilter) HtmlControlDesigner ControlDesigner

Subclasses

Multiple types

    [ Team LiB ] Previous Section Next Section