This documentation is archived and is not being maintained.

DesignSurface Class

Presents a user interface for designing components.


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

[PermissionSetAttribute(SecurityAction.LinkDemand, Name = "FullTrust")]
[PermissionSetAttribute(SecurityAction.InheritanceDemand, Name = "FullTrust")]
public class DesignSurface : IDisposable, 

The DesignSurface type exposes the following members.

Public methodDesignSurface()Initializes a new instance of the DesignSurface class.
Public methodDesignSurface(IServiceProvider)Initializes a new instance of the DesignSurface class.
Public methodDesignSurface(Type)Initializes a new instance of the DesignSurface class.
Public methodDesignSurface(IServiceProvider, Type)Initializes a new instance of the DesignSurface class.

Public propertyComponentContainerGets the IContainer implementation within the design surface.
Public propertyDtelLoadingGets a value indicating whether the Design-time Error List is loading.
Public propertyIsLoadedGets a value indicating whether the design surface is currently loaded.
Public propertyLoadErrorsReturns a collection of loading errors or a void collection.
Protected propertyServiceContainerGets the service container.
Public propertyViewGets the view for the root designer.

Public methodBeginLoad(DesignerLoader)Begins the loading process with the given designer loader.
Public methodBeginLoad(Type)Begins the loading process.
Protected methodCreateComponent Obsolete. Creates an instance of a component.
Protected methodCreateDesignerCreates a designer when a component is added to the container.
Protected methodCreateInstanceCreates an instance of the given type.
Public methodCreateNestedContainer(IComponent)Creates a container suitable for nesting controls or components.
Public methodCreateNestedContainer(IComponent, String)Creates a container suitable for nesting controls or components.
Public methodDispose()Releases the resources used by the DesignSurface.
Protected methodDispose(Boolean)Releases the resources used by the DesignSurface.
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodFlushSerializes changes to the design surface.
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetServiceGets a service from the service container.
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Protected methodOnLoadedRaises the Loaded event.
Protected methodOnLoadingRaises the Loading event.
Protected methodOnUnloadedRaises the Unloaded event.
Protected methodOnUnloadingRaises the Unloading event.
Protected methodOnViewActivateRaises the ViewActivated event.
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)

Public eventDisposedOccurs when the design surface is disposed.
Public eventFlushedOccurs when a call is made to the Flush method of DesignSurface.
Public eventLoadedOccurs when the designer load has completed.
Public eventLoadingOccurs when the designer is about to be loaded.
Public eventUnloadedOccurs when a designer has finished unloading.
Public eventUnloadingOccurs when a designer is about to unload.
Public eventViewActivatedOccurs when the Activate method has been called on IDesignerHost.

The DesignSurface class implements what the user perceives as a designer. DesignSurface is the user interface the user manipulates to change design-time features. DesignSurface provides a completely self-contained design surface.

The DesignSurface class may be used as a stand-alone designer, or it may be coupled with the DesignSurfaceManager class to provide a common implementation for an application that hosts multiple DesignSurface objects.

The DesignSurface class can be used by itself, or the user can derive a new class from it and augment the behavior.

The DesignSurface class provides several design-time services automatically. The DesignSurface class adds all of its services in its constructor. Most of these services can be overridden by replacing them in the protected ServiceContainer property. To replace a service, override the constructor, call base, and make any changes through the protected ServiceContainer property. All services that are added to the service container and that implement IDisposable are disposed when the design surface is disposed. The default set of replaceable services that the DesignSurface class provides is shown in the following table.




Enables objects that are not part of the container’s components collection to provide their own extender providers.


Used by TypeDescriptor to get a list of extender providers. With this service, extender providers can live outside of the container.


Provides designer metadata hooks. This is the primary interface for metadata filtering.


Provides a way to select components in the designer.


Provides a way to get a name for objects, even when those objects are not sited.


Offers the design surface itself as a service.


Provides a base class for getting and setting option values for a designer.

The following table shows the non-replaceable services provided by default.




Raises events as changes are made to components.


Controls access to types, services, and transactions. Master interface for designers.


Owns the set of components that are being designed. Each designer has an IContainer that owns the components.


Derives from IServiceProvider and provides a way to add and remove services from the designer.

In addition to these services, the DesignSurface class also provides a single service that is available through a component’s site. This service is unique for each component. The following table shows the services that cannot be replaced.




A generic dictionary of key/value pairs that can be used to store arbitrary data about a component.


A container that enables a component to add additional child components to the designer. These components will be part of the design surface, but will not participate in serialization. This is useful when you want to design a control that is capable of exposing a region of itself in a designer, but you do not want the region to participate in serialization.

In addition to ISite, the site also implements the following interfaces.

Caution noteCaution

Check for the existence of these interfaces, rather than use indiscriminate casting, because other site implementations may not implement them.




Provides a way to get to the container of site-specific services. For example, IDictionaryService is a site-specific service. With this service, you can add additional site-specific services.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

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

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.