Redigera

Dela via


DesignSurface.CreateDesigner(IComponent, Boolean) Method

Definition

Creates a designer when a component is added to the container.

protected public:
 virtual System::ComponentModel::Design::IDesigner ^ CreateDesigner(System::ComponentModel::IComponent ^ component, bool rootDesigner);
protected internal virtual System.ComponentModel.Design.IDesigner CreateDesigner (System.ComponentModel.IComponent component, bool rootDesigner);
protected internal virtual System.ComponentModel.Design.IDesigner? CreateDesigner (System.ComponentModel.IComponent component, bool rootDesigner);
abstract member CreateDesigner : System.ComponentModel.IComponent * bool -> System.ComponentModel.Design.IDesigner
override this.CreateDesigner : System.ComponentModel.IComponent * bool -> System.ComponentModel.Design.IDesigner
Protected Friend Overridable Function CreateDesigner (component As IComponent, rootDesigner As Boolean) As IDesigner

Parameters

component
IComponent

The component for which the designer should be created.

rootDesigner
Boolean

true to create a root designer; false to create a normal designer.

Returns

An instance of the requested designer, or null if no matching designer could be found.

Exceptions

component is null.

The IDesignerHost attached to the DesignSurface has been disposed.

Remarks

The CreateDesigner method is called by the design surface's IContainer when a component is added to the container. This method creates a designer, but does not initialize it. When it returns, the designer is initialized by the container.

CreateDesigner can create two different types of designers: root designers and normal designers. A root designer is a designer for the root component in the design surface, which by definition is the first component added to the container. Root designers differ from normal designers because they are responsible for the user interface presented to the end user. Root designers typically coordinate with the rest of the designers on a design surface to provide this interface.

The default implementation of this method delegates to TypeDescriptor, passing in IRootDesigner as the designer type for root designers, or IDesigner for normal designers. You can override this method to request a specific type of designer.

Applies to