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 的類別。
可重複 No
必要的屬性 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)

適用於