ToolBoxTabs.Add(String) Método
Definição
Importante
Algumas informações se referem a produtos de pré-lançamento que podem ser substancialmente modificados antes do lançamento. A Microsoft não oferece garantias, expressas ou implícitas, das informações aqui fornecidas.
Cria uma nova guia no ToolBox e a adiciona à ToolBoxTabs coleção.
public:
EnvDTE::ToolBoxTab ^ Add(System::String ^ Name);
public:
EnvDTE::ToolBoxTab ^ Add(Platform::String ^ Name);
EnvDTE::ToolBoxTab Add(std::wstring const & Name);
[System.Runtime.InteropServices.DispId(4)]
public EnvDTE.ToolBoxTab Add (string Name);
[<System.Runtime.InteropServices.DispId(4)>]
abstract member Add : string -> EnvDTE.ToolBoxTab
Public Function Add (Name As String) As ToolBoxTab
Parâmetros
- Name
- String
Obrigatórios. O nome da guia.
Retornos
Um objeto ToolBoxTab.
- Atributos
Exemplos
Sub ToolBoxAddExample()
' This adds a tab to the Toolbox.
' Define the variables and create an object reference to the IDE's
' ToolBox object.
Dim win As Window = DTE.Windows.Item(Constants.vsWindowKindToolbox)
Dim tlBox As ToolBox = win.Object
Dim tbxTabs As ToolBoxTabs
' Create an object reference to the ToolBoxTabs object.
tbxTabs = tlBox.ToolBoxTabs
' Add a new tab to the Toolbox.
tbxTabs.Add("MyTab")
End Sub
' The following example demonstrates how to add a .NET component to the
' Toolbox by using a path to the file. The component to be added must
' be a .NET control, such as a Visual Basic Windows Control Library
' component.
Sub ToolBoxItemAddExample2()
Try
Dim tlBox As ToolBox
tlBox = CType(DTE.Windows.Item(Constants. _
vsWindowKindToolbox).Object, EnvDTE.ToolBox)
' Create a new tab called "My Controls."
Dim tlBoxTab As ToolBoxTab = tlBox.ToolBoxTabs. _
Add("My Controls")
' Set focus to the new Toolbox tab.
tlBoxTab.Activate()
' Add a .NET control as a new control in the new Toolbox tab. The
' constant "vsToolBoxItemFormatDotNETComponent" alerts the Toolbox
' to the type of control you are adding.
tlBoxTab.ToolBoxItems.Add("MyDotNetControl", _
"C:\Libraries\ADotNetControl.dll(", _
vsToolBoxItemFormat.vsToolBoxItemFormatDotNETComponent)
Catch ex As System.Exception
' Display any errors that occur.
MsgBox("ERROR: " & ex.Message)
End Try
End Sub