Compartilhar via


DesignSurfaceExtension Class

The base class for any object provided by a VSPackage to be called by the Visual Studio environment upon designer creation to customize or extend services and metadata provided by any implementation of DesignSurface.

Inheritance Hierarchy

System.Object
  Microsoft.VisualStudio.Shell.Design.DesignSurfaceExtension

Namespace:  Microsoft.VisualStudio.Shell.Design
Assembly:  Microsoft.VisualStudio.Shell.Design (in Microsoft.VisualStudio.Shell.Design.dll)

Syntax

'Declaração
<ComVisibleAttribute(True)> _
Public MustInherit Class DesignSurfaceExtension _
    Implements IDisposable
[ComVisibleAttribute(true)]
public abstract class DesignSurfaceExtension : IDisposable

The DesignSurfaceExtension type exposes the following members.

Constructors

  Name Description
Protected method DesignSurfaceExtension Create a new instance of the DesignSurfaceExtension class.

Top

Properties

  Name Description
Protected property Surface Gets the design surface this extension was initialized with.

Top

Methods

  Name Description
Public method Dispose() Disposes this object and its resources.
Protected method Dispose(Boolean) Disposes this object and its resources.
Public method Equals Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected method Finalize Destroys the object. (Overrides Object.Finalize().)
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method Initialize Initializes the design surface extension.
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method OnComponentCreated This method is called when a new component is created but before that component is added to the designer.
Public method OnDesignerCreated(IDesigner) Obsolete. This method is called when a new designer is created.
Public method OnDesignerCreated(IComponent, IDesigner, Boolean) This method is called when a new designer is created.
Public method ToString Returns a string that represents the current object. (Inherited from Object.)

Top

Remarks

DesignSurfaceExtension object must be registered by applying the following Attribute instances applied to a VSPackage's Package implementation:

  • DesignSurfaceExtensionAttribute to notify the Visual Studio environment that the DesignSurfaceExtension implementation as providing customization of the design surface at designer load time.

  • ProvideObjectAttribute to indicate that the VSPackage provides instances of the DesignSurfaceExtension object.

  • ProvideServiceAttribute to indicate that the DesignSurfaceExtension implementation is provided by the VSPackage as a Visual Studio SDK service.

An application already loaded by the Visual Studio environment can provide dynamic modification of a designer surface's services or metadata at surface or component creation by handling DesignerCreated event.

However, as VSPackages are demand loaded, a package may not have been loaded by the Visual Studio environment prior to the loading of a design surface, and thus would not be able to subscribe to DesignerCreated event.

To handle this problem, whenever any design surfaces or designer component is created, the Visual Studio environment creates instances of registered DesignSurfaceExtension and applies them to the created surface or component.

This guarantees that a VSPackage's designer start up modifications are correctly executed and the VSPackage itself is loaded as needed.

Thread Safety

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

See Also

Reference

Microsoft.VisualStudio.Shell.Design Namespace

DesignSurfaceExtensionAttribute

DesignSurface

IDesigner

IDesignerHost

Other Resources

Extending Design-Time Support