ערוך

שתף באמצעות


DesignSurface Class

Definition

Presents a user interface for designing components.

public ref class DesignSurface : IDisposable, IServiceProvider
public class DesignSurface : IDisposable, IServiceProvider
[System.Security.SecurityCritical]
public class DesignSurface : IDisposable, IServiceProvider
type DesignSurface = class
    interface IDisposable
    interface IServiceProvider
[<System.Security.SecurityCritical>]
type DesignSurface = class
    interface IDisposable
    interface IServiceProvider
Public Class DesignSurface
Implements IDisposable, IServiceProvider
Inheritance
DesignSurface
Attributes
Implements

Remarks

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.

Service Description
IExtenderProviderService Enables objects that are not part of the container's components collection to provide their own extender providers.
IExtenderListService Used by TypeDescriptor to get a list of extender providers. With this service, extender providers can live outside of the container.
ITypeDescriptorFilterService Provides designer metadata hooks. This is the primary interface for metadata filtering.
ISelectionService Provides a way to select components in the designer.
IReferenceService Provides a way to get a name for objects, even when those objects are not sited.
DesignSurface Offers the design surface itself as a service.
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.

Service Description
IComponentChangeService Raises events as changes are made to components.
IDesignerHost Controls access to types, services, and transactions. Primary interface for designers.
IContainer Owns the set of components that are being designed. Each designer has an IContainer that owns the components.
IServiceContainer 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.

Service Description
IDictionaryService A generic dictionary of key/value pairs that can be used to store arbitrary data about a component.
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 ISite, the site also implements the following interfaces.

Caution

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

Service Description
IServiceContainer 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.

Constructors

DesignSurface()

Initializes a new instance of the DesignSurface class.

DesignSurface(IServiceProvider, Type)

Initializes a new instance of the DesignSurface class.

DesignSurface(IServiceProvider)

Initializes a new instance of the DesignSurface class.

DesignSurface(Type)

Initializes a new instance of the DesignSurface class.

Properties

ComponentContainer

Gets the IContainer implementation within the design surface.

DtelLoading

Gets a value indicating whether the Design-time Error List is loading.

IsLoaded

Gets a value indicating whether the design surface is currently loaded.

LoadErrors

Returns a collection of loading errors or a void collection.

ServiceContainer

Gets the service container.

View

Gets the view for the root designer.

Methods

BeginLoad(DesignerLoader)

Begins the loading process with the given designer loader.

BeginLoad(Type)

Begins the loading process.

CreateComponent(Type)
Obsolete.

Creates an instance of a component.

CreateDesigner(IComponent, Boolean)

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

CreateInstance(Type)

Creates an instance of the given type.

CreateNestedContainer(IComponent, String)

Creates a container suitable for nesting controls or components.

CreateNestedContainer(IComponent)

Creates a container suitable for nesting controls or components.

Dispose()

Releases the resources used by the DesignSurface.

Dispose(Boolean)

Releases the resources used by the DesignSurface.

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
Flush()

Serializes changes to the design surface.

GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetService(Type)

Gets a service from the service container.

GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
OnLoaded(LoadedEventArgs)

Raises the Loaded event.

OnLoading(EventArgs)

Raises the Loading event.

OnUnloaded(EventArgs)

Raises the Unloaded event.

OnUnloading(EventArgs)

Raises the Unloading event.

OnViewActivate(EventArgs)

Raises the ViewActivated event.

ToString()

Returns a string that represents the current object.

(Inherited from Object)

Events

Disposed

Occurs when the design surface is disposed.

Flushed

Occurs when a call is made to the Flush() method of DesignSurface.

Loaded

Occurs when the designer load has completed.

Loading

Occurs when the designer is about to be loaded.

Unloaded

Occurs when a designer has finished unloading.

Unloading

Occurs when a designer is about to unload.

ViewActivated

Occurs when the Activate() method has been called on IDesignerHost.

Applies to

See also