Freigeben über


ToolWindows.ToolBox Property

Gets the ToolBox object.

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

Syntax

'Declaration
ReadOnly Property ToolBox As ToolBox
ToolBox ToolBox { get; }
property ToolBox^ ToolBox {
    ToolBox^ get ();
}
abstract ToolBox : ToolBox with get
function get ToolBox () : ToolBox

Property Value

Type: EnvDTE.ToolBox
A ToolBox object.

Examples

This example opens the Toolbox, displays the name of the active tab, adds a new tab, and then deletes it.

For more information about how to run this example as an add-in, see How to: Compile and Run the Automation Object Model Code Examples.

Imports EnvDTE
Imports EnvDTE80
Public Sub OnConnection(ByVal application As Object, _
 ByVal connectMode As ext_ConnectMode, ByVal addInInst As Object, _
 ByRef custom As Array) Implements IDTExtensibility2.OnConnection
    _applicationObject = CType(application, DTE2)
    _addInInstance = CType(addInInst, AddIn)
    ToolboxManip(_applicationObject)
End Sub
Public Sub ToolboxManip(ByVal dte As DTE2)
    Dim myToolBox As ToolBox
    myToolBox = _applicationObject.ToolWindows.ToolBox
    _applicationObject.ExecuteCommand("View.toolbox", " ")
    MsgBox("The total number of Toolbox tabs is: " _
    & myToolBox.ToolBoxTabs.Count)
    MsgBox("The name of the active Toolbox tab is: " _
    & myToolBox.ActiveTab.Name)
    MsgBox("Adding a MyTab to the Toolbox...")
    myToolBox.ToolBoxTabs.Add("MyTab")
    MsgBox("Deleting MyTab from the Toolbox")
    myToolBox.ToolBoxTabs.Item("MyTab").Delete()
    End Sub
using EnvDTE;
using EnvDTE80;
using System.Windows.Forms;
public void OnConnection(object application, 
ext_ConnectMode connectMode, object addInInst, ref Array custom)
{
    _applicationObject = (DTE2)application;
    _addInInstance = (AddIn)addInInst;
    ToolboxManip (_applicationObject);
}
public void ToolboxManip (DTE2 dte)
{
    ToolBox myToolBox;
    myToolBox = _applicationObject.ToolWindows.ToolBox;
    _applicationObject.ExecuteCommand("View.toolbox", " ");
    MessageBox.Show("The total number of Toolbox tabs is: " 
+ myToolBox.ToolBoxTabs.Count);
    MessageBox.Show("The name of the active Toolbox tab is: " 
+ myToolBox.ActiveTab.Name);
    MessageBox.Show("Adding a MyTab to the Toolbox...");
    myToolBox.ToolBoxTabs.Add("MyTab");
    MessageBox.Show("Deleting MyTab from the Toolbox");
    myToolBox.ToolBoxTabs.Item("MyTab").Delete();
}

.NET Framework Security

See Also

Reference

ToolWindows Interface

EnvDTE80 Namespace