Export (0) Print
Expand All

ControlDesigner.EnableDesignMode Method

Enables design time functionality for a child control.

Namespace:  System.Windows.Forms.Design
Assembly:  System.Design (in System.Design.dll)

protected bool EnableDesignMode(
	Control child,
	string name
)

Parameters

child
Type: System.Windows.Forms.Control

The child control for which design mode will be enabled.

name
Type: System.String

The name of child as exposed to the end user.

Return Value

Type: System.Boolean
true if the child control could be enabled for design time; false if the hosting infrastructure does not support it.

ExceptionCondition
ArgumentNullException

child or name is null.

The child control specified by child is a child of this control designer's control. The child does not directly participate in persistence, but it will if it is exposed as a property of the main control. Consider a control like the SplitContainer: it has two panels, Panel1 and Panel2. These panels are exposed through read only Panel1 and Panel2 properties on the SplitContainer control. The SplitContainer control's designer calls EnableDesignMode for each panel, which allows other components to be dropped on them. But, in order for the contents of Panel1 and Panel2 to be saved, the SplitContainer control itself must expose the panels as public properties.

Control names must be unique within a control designer, but they are not required to be unique with respect to the children of other control designers.

To support this feature, the hosting infrastructure must expose the INestedContainer class as a service through the site.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft