この記事は翻訳者によって翻訳されたものです。 記事の文章にポインターを重ねると、原文のテキストが表示されます。
訳文
原文
このトピックはまだ評価されていません - このトピックを評価する

ToolBoxItems インターフェイス

[ツールボックス] タブ内のすべてのアイテムが含まれます。

名前空間:  EnvDTE
アセンブリ:  EnvDTE (EnvDTE.dll 内)
[GuidAttribute("395C7DFB-F158-431C-8F43-DDA83B4EF54E")]
public interface ToolBoxItems : IEnumerable

ToolBoxItems 型で公開されるメンバーは以下のとおりです。

  名前 説明
パブリック プロパティ Count ToolBoxItems コレクション内のオブジェクトの数を示す値を取得します。
パブリック プロパティ DTE トップ レベルの機能拡張オブジェクトを取得します。
パブリック プロパティ Parent ToolBoxItems オブジェクトの直接の親オブジェクトを取得します。
パブリック プロパティ SelectedItem [ツールボックス] のタブで現在選択されているアイテムがある場合は、そのアイテムを取得します。
このページのトップへ
  名前 説明
パブリック メソッド Add 新しいアイテムを作成し、[ツールボックス] に追加します。
パブリック メソッド GetEnumerator() コレクションを反復処理する列挙子を返します。 (IEnumerable から継承されます。)
パブリック メソッド GetEnumerator() コレクション内の項目の列挙子を取得します。
パブリック メソッド Item ToolBoxItems コレクション内の ToolBoxItem オブジェクトを返します。
このページのトップへ

ToolBoxItems コレクションの既定のプロパティは、Item です。このプロパティを使用して、名前または序数によるインデックスを付けることができます。

Sub ToolBoxItemsExample()
    Dim tlBox As ToolBox
    Dim tbxTabs As ToolBoxTabs
    Dim tbxTab As ToolBoxTab
    Dim tbxItems As ToolBoxItems

    Try
        ' Create an object reference to the IDE's ToolBox object and
        ' its tabs.
        tlBox = DTE.Windows.Item(Constants.vsWindowKindToolbox).Object
        tbxTabs = tlBox.ToolBoxTabs

        ' Add a new tab to the ToolBox and select it.
        tbxTab = tbxTabs.Add("New ToolBox Tab")
        tbxTab.Activate()

        ' Add new items to the new ToolBox tab. This shows two
        ' different ways to index the ToolBox tabs. The third item
        ' added is a .NET component that contains a number of 
        ' Web-related controls.
        tbxTab.ToolBoxItems.Add("Text Item", "Hello world")
        tbxTab.ToolBoxItems.Add("HTML Item", "Hello world", _
        vsToolBoxItemFormat.vsToolBoxItemFormatHTML)
        tbxTabs.Item("New ToolBox Tab").ToolBoxItems.Add("DotNET _
        Component", "C:\WINNT\Microsoft.NET\Framework\v1.1.4322 _
        \System.Web.dll", vsToolBoxItemFormat. _
        vsToolBoxItemFormatDotNETComponent)

        ' Use the ToolboxItems collection to access all the items under 
        ' a ToolBox tab.
        tbxItems = tbxTab.ToolBoxItems

        ' List number of ToolboxItems in a ToolBoxTab.
        MsgBox("Number of items in " & tbxTabs.Item(1).Name & " tab: _
        " & tbxItems.Count)

        ' Select the second item in the ToolboxItems collection and 
        ' delete it.
        tbxItems.Item(2).Select()
        If (MsgBox("Delete second ToolBox item?", vbYesNo) = vbYes) _
        Then
            tbxItems.SelectedItem.Delete()
            MsgBox("Number of items in " & tbxTabs.Item(1).Name & " _
            tab: " & tbxItems.Count)
        End If
    Catch ex As System.Exception
        MsgBox("ERROR: " & ex.Message)
    End Try
End Sub
この情報は役に立ちましたか。
(残り 1500 文字)
コミュニティ コンテンツ 追加
注釈 FAQ