ToolWindows.ToolBox 属性

获取 ToolBox 对象。

命名空间:  EnvDTE80
程序集:  EnvDTE80(在 EnvDTE80.dll 中)

语法

声明
ReadOnly Property ToolBox As ToolBox
ToolBox ToolBox { get; }
property ToolBox^ ToolBox {
    ToolBox^ get ();
}
abstract ToolBox : ToolBox
function get ToolBox () : ToolBox

属性值

类型:EnvDTE.ToolBox
ToolBox 对象。

示例

此示例打开**“工具箱”**,显示活动选项卡的名称,添加新选项卡,然后删除它。

有关如何作为外接程序运行此示例的更多信息,请参见 如何:编译和运行自动化对象模型代码示例

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 安全性

请参见

参考

ToolWindows 接口

EnvDTE80 命名空间