Share via


ToolBoxItems-Schnittstelle

Enthält alle Elemente einer ToolBox-Registerkarte.

Namespace:  EnvDTE
Assembly:  EnvDTE (in EnvDTE.dll)

Syntax

'Declaration
<GuidAttribute("395C7DFB-F158-431C-8F43-DDA83B4EF54E")> _
Public Interface ToolBoxItems _
    Inherits IEnumerable
[GuidAttribute("395C7DFB-F158-431C-8F43-DDA83B4EF54E")]
public interface ToolBoxItems : IEnumerable
[GuidAttribute(L"395C7DFB-F158-431C-8F43-DDA83B4EF54E")]
public interface class ToolBoxItems : IEnumerable
[<GuidAttribute("395C7DFB-F158-431C-8F43-DDA83B4EF54E")>]
type ToolBoxItems =  
    interface 
        interface IEnumerable 
    end
public interface ToolBoxItems extends IEnumerable

Der ToolBoxItems-Typ macht die folgenden Member verfügbar.

Eigenschaften

  Name Beschreibung
Öffentliche Eigenschaft Count Ruft einen Wert ab, der die Anzahl der in der ToolBoxItems-Auflistung enthaltenen Objekte angibt.
Öffentliche Eigenschaft DTE Ruft das Erweiterbarkeitsobjekt der obersten Ebene ab.
Öffentliche Eigenschaft Parent Ruft das unmittelbar übergeordnete Objekt eines ToolBoxItems-Objekts ab.
Öffentliche Eigenschaft SelectedItem Ruft das Element ab, das momentan auf der Registerkarte der ToolBox ausgewählt ist, sofern vorhanden.

Zum Seitenanfang

Methoden

  Name Beschreibung
Öffentliche Methode Add Erstellt ein neues Element und fügt es der ToolBox hinzu.
Öffentliche Methode GetEnumerator Ruft einen Enumerator für Elemente in der Auflistung ab.
Öffentliche Methode Item Gibt ein ToolBoxItem-Objekt in einer ToolBoxItems-Auflistung zurück.

Zum Seitenanfang

Hinweise

Die Standardeigenschaft der ToolBoxItems-Auflistung lautet Item. Dadurch ist eine Indizierung nach Name oder nach Ordinalzahl möglich.

Beispiele

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

Siehe auch

Referenz

EnvDTE-Namespace

Weitere Ressourcen

Gewusst wie: Steuern der Toolbox