共用方式為


ProvideToolWindowAttribute Class

Notifies Visual Studio that a VSPackage owns a tool window.

Inheritance Hierarchy

System.Object
  System.Attribute
    Microsoft.VisualStudio.Shell.RegistrationAttribute
      Microsoft.VisualStudio.Shell.ProvideToolWindowAttribute

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

Syntax

'宣告
<AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple := True, Inherited := True)> _
Public NotInheritable Class ProvideToolWindowAttribute _
    Inherits RegistrationAttribute
[AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
public sealed class ProvideToolWindowAttribute : RegistrationAttribute

The ProvideToolWindowAttribute type exposes the following members.

Constructors

  Name Description
Public method ProvideToolWindowAttribute Initializes a new instance of ProvideToolWindowAttribute.

Top

Properties

  Name Description
Public property DockedHeight
Public property DockedWidth
Public property DocumentLikeTool
Public property Height Gets or sets the default height of the tool window.
Public property MultiInstances Determines whether multiple instances of the tool window are allowed.
Public property Orientation Gets or sets the default orientation for the tool window relative to the window specified by the Window property.
Public property PositionX Gets or sets the default horizontal value of the top left corner of the tool window.
Public property PositionY Gets or sets the vertical value of the top left corner of the tool window.
Public property Style Gets or sets the default docking style for the tool window.
Public property ToolType Gets or sets the type of the tool window.
Public property Transient Gets or sets whether the tool window should not be reopened when the IDE restarts.
Public property TypeId Gets the current instance of this attribute. (Inherited from RegistrationAttribute.)
Public property Width Gets or sets the default width of the tool window.
Public property Window Gets or sets the GUID of the default window on which the tool window should be docked.

Top

Methods

  Name Description
Public method Equals Infrastructure. Returns a value that indicates whether this instance is equal to a specified object. (Inherited from Attribute.)
Public method GetHashCode Returns the hash code for this instance. (Inherited from Attribute.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method IsDefaultAttribute When overridden in a derived class, indicates whether the value of this instance is the default value for the derived class. (Inherited from Attribute.)
Public method Match When overridden in a derived class, returns a value that indicates whether this instance equals a specified object. (Inherited from Attribute.)
Public method Register Registers the tool window. (Overrides RegistrationAttribute.Register(RegistrationAttribute.RegistrationContext).)
Public method ToString Returns a string that represents the current object. (Inherited from Object.)
Public method Unregister Removes the registry key for the tool window. (Overrides RegistrationAttribute.Unregister(RegistrationAttribute.RegistrationContext).)

Top

Explicit Interface Implementations

  Name Description
Explicit interface implemetationPrivate method _Attribute.GetIDsOfNames Maps a set of names to a corresponding set of dispatch identifiers. (Inherited from Attribute.)
Explicit interface implemetationPrivate method _Attribute.GetTypeInfo Retrieves the type information for an object, which can be used to get the type information for an interface. (Inherited from Attribute.)
Explicit interface implemetationPrivate method _Attribute.GetTypeInfoCount Retrieves the number of type information interfaces that an object provides (either 0 or 1). (Inherited from Attribute.)
Explicit interface implemetationPrivate method _Attribute.Invoke Provides access to properties and methods exposed by an object. (Inherited from Attribute.)

Top

Remarks

When to Call

Implement the ProvideToolWindowAttribute class when a VSPackage implements one or more tool windows.

Basic Usage

This attribute declares that a specific VSPackage owns a tool window. It also helps determine the positioning and persistence of the tool window when it is created. To use ProvideToolWindowAttribute, place it on a package class derived from Package or implementing IVsPackage.

This attribute is only used to provide data for external registration tools. It does not have any effect on the runtime behavior of the VSPackage.

Registry Entries

  • The ProvideToolWindowAttribute class creates the following registry entries:

  • <VSROOT>\ToolWindows\{ToolWindowGuid}

  • <VSROOT>\ToolWindows\{ToolWindowGuid}\@={ToolWindowTypeGuid}

  • <VSROOT>\ToolWindows\{ToolWindowGuid}\Name=ToolWindowName

  • The following registry entries are optional:

  • <VSROOT>\ToolWindows\{ToolWindowGuid}\Float=FloatPosition

  • <VSROOT>\ToolWindows\{ToolWindowGuid}\Style=ToolWindowStyle

  • <VSROOT>\ToolWindows\{ToolWindowGuid}\Window=DockWith

  • <VSROOT>\ToolWindows\{ToolWindowGuid}\Orientation=ToolWindowOrientation

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 Namespace