Share via


ProvideToolboxItemsAttribute 类

定义

将此属性应用于实现 VSPackage 的类,以声明它们是否向 Visual Studio 工具箱提供一组项。

public ref class ProvideToolboxItemsAttribute : Microsoft::VisualStudio::Shell::RegistrationAttribute
[System.AttributeUsage(System.AttributeTargets.Class, Inherited=true)]
public class ProvideToolboxItemsAttribute : Microsoft.VisualStudio.Shell.RegistrationAttribute
[<System.AttributeUsage(System.AttributeTargets.Class, Inherited=true)>]
type ProvideToolboxItemsAttribute = class
    inherit RegistrationAttribute
Public Class ProvideToolboxItemsAttribute
Inherits RegistrationAttribute
继承
ProvideToolboxItemsAttribute
属性

示例

在下面的示例中,应用于 类 MyPackage 的属性指示它支持具有两种剪贴板格式“CF_XMLCODE”和“InPlaceMenuEditorMenu”的 工具箱 项的版本 1。

[DefaultRegistryRoot("Software\\Microsoft\\VisualStudio\\8.0")]  
[ProvideToolboxItems(true, 1)]  
[ProvideToolboxFormat("CF_XMLCODE")]  
[ProvideToolboxFormat("InPlaceMenuEditorMenu")]  
[Guid("XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX")]  
internal sealed class MyPackage : Package  

注解

特性上下文

适用于 通过实现 IVsPackagePackage来提供 VSPackage 的类。
可重复
必需属性 ProvideToolboxFormatAttribute
无效的特性

将此属性应用于 Package派生类或实现 IVsPackage 的类,使用户能够支持将此类提供的格式的数据对象拖动到 工具箱中。 此实现类必须处理删除通知本身。

此属性仅用于注册目的,不会影响代码在运行时的行为方式。

根据其构造函数中指定的参数,此属性可以指示 VSPackage 不提供任何 工具箱 项。 如果将 特性 ProvideToolboxFormatAttribute 添加到类,以指示它提供 工具箱 项,则还必须添加 的 ProvideToolboxFormatAttribute 一个或多个实例。

此属性使用 ProvideToolboxFormatAttribute 将 VSPackage 注册为提供给定格式的 工具箱 项。

如果此属性指定提供 工具箱 项,则 VSPackage 必须处理 ToolboxInitializedToolboxUpgraded 事件。

任何使用此属性的 VSPackage 都必须为 和 ToolboxUpgraded 事件提供处理程序ToolboxInitialized

构造函数

ProvideToolboxItemsAttribute(Int32)

创建 一个新实例, ProvideToolboxItemsAttribute 该实例指示实现 VSPackage 的类是否提供工具箱项。

ProvideToolboxItemsAttribute(Int32, Boolean)

为指定版本初始化 的新 ProvideToolboxItemsAttribute 实例。

属性

NeedsCallBackAfterReset

将此值设置为 true 将在每次工具箱重置后强制创建一个 ToolboxInitialized 事件。 在开发包以强制工具箱每次 (向包请求项列表,以防包) 更改时,可以使用此方法。 对于已发货的产品,最好将其保留为 false,以便使用缓存来提高性能。 某些方案 (,例如无法保存到缓存的项列表) 可能需要将此标志设置为 true

TypeId

重写 TypeID 属性,使 RegistrationAttribute 派生类能够与 System.ComponentModel.TypeDescriptor.GetAttributes 一起使用 (...) 。仅当派生自此属性的属性需要对可应用于类的实例使用更好的控件时,它才必须重写此属性。

(继承自 RegistrationAttribute)
Version

返回 VSPackage 提供的工具箱项版本的属性。

方法

GetPackageRegKeyPath(Guid)

获取相对于 VSPackage 的应用程序) 注册表根目录 (注册表路径。

(继承自 RegistrationAttribute)
Register(RegistrationAttribute+RegistrationContext)

当外部注册工具(如 regpkg.exe)调用时,将 VSPackage 注册为指定格式的工具箱项提供程序。 有关详细信息,请参阅注册 VSPackages。

Unregister(RegistrationAttribute+RegistrationContext)

撤消方法已应用于注册表的更改 Register(RegistrationAttribute+RegistrationContext)

适用于