See Also: DesignSurface Members
The System.ComponentModel.Design.DesignSurface class implements what the user perceives as a designer. System.ComponentModel.Design.DesignSurface is the user interface the user manipulates to change design-time features. System.ComponentModel.Design.DesignSurface provides a completely self-contained design surface.
The System.ComponentModel.Design.DesignSurface class may be used as a stand-alone designer, or it may be coupled with the System.ComponentModel.Design.DesignSurfaceManager class to provide a common implementation for an application that hosts multiple System.ComponentModel.Design.DesignSurface objects.
The System.ComponentModel.Design.DesignSurface class can be used by itself, or the user can derive a new class from it and augment the behavior.
The System.ComponentModel.Design.DesignSurface class provides several design-time services automatically. The System.ComponentModel.Design.DesignSurface class adds all of its services in its constructor. Most of these services can be overridden by replacing them in the protected DesignSurface.ServiceContainer property. To replace a service, override the constructor, call base, and make any changes through the protected DesignSurface.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 System.ComponentModel.Design.DesignSurface class provides is shown in the following table.
System.ComponentModel.Design.IExtenderProviderService |
Enables objects that are not part of the container’s components collection to provide their own extender providers. |
System.ComponentModel.Design.IExtenderListService |
Used by System.ComponentModel.TypeDescriptor to get a list of extender providers. With this service, extender providers can live outside of the container. |
System.ComponentModel.Design.ITypeDescriptorFilterService |
Provides designer metadata hooks. This is the primary interface for metadata filtering. |
System.ComponentModel.Design.ISelectionService |
Provides a way to select components in the designer. |
System.ComponentModel.Design.IReferenceService |
Provides a way to get a name for objects, even when those objects are not sited. |
System.ComponentModel.Design.DesignSurface |
Offers the design surface itself as a service. |
System.ComponentModel.Design.DesignerOptionService |
Provides a base class for getting and setting option values for a designer. |
The following table shows the non-replaceable services provided by default.
System.ComponentModel.Design.IComponentChangeService |
Raises events as changes are made to components. |
System.ComponentModel.Design.IDesignerHost |
Controls access to types, services, and transactions. Master interface for designers. |
System.ComponentModel.IContainer |
Owns the set of components that are being designed. Each designer has an System.ComponentModel.IContainer that owns the components. |
System.ComponentModel.Design.IServiceContainer |
Derives from IServiceProvider and provides a way to add and remove services from the designer. |
In addition to these services, the System.ComponentModel.Design.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.
System.ComponentModel.Design.IDictionaryService |
A generic dictionary of key/value pairs that can be used to store arbitrary data about a component. |
System.ComponentModel.INestedContainer |
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 System.ComponentModel.ISite, the site also implements the following interfaces.
Check for the existence of these interfaces, rather than use indiscriminate casting, because other site implementations may not implement them.
System.ComponentModel.Design.IServiceContainer |
Provides a way to get to the container of site-specific services. For example, System.ComponentModel.Design.IDictionaryService is a site-specific service. With this service, you can add additional site-specific services. |