Export (0) Print
Expand All

DesignSurface.CreateDesigner Method

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

Namespace:  System.ComponentModel.Design
Assembly:  System.Design (in System.Design.dll)

protected internal virtual IDesigner CreateDesigner(
	IComponent component,
	bool rootDesigner
)

Parameters

component
Type: System.ComponentModel.IComponent

The component for which the designer should be created.

rootDesigner
Type: System.Boolean

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

Return Value

Type: System.ComponentModel.Design.IDesigner
An instance of the requested designer, or null if no matching designer could be found.

ExceptionCondition
ArgumentNullException

component is null.

ObjectDisposedException

The IDesignerHost attached to the DesignSurface has been disposed.

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.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0
Show:
© 2015 Microsoft