Partager via


ToolBoxTab2.Delete, méthode

Supprime le ToolBoxTab d'une collection.

Espace de noms :  EnvDTE80
Assembly :  EnvDTE80 (dans EnvDTE80.dll)

Syntaxe

'Déclaration
Sub Delete
void Delete()
void Delete()
abstract Delete : unit -> unit
function Delete()

Exemples

Cet exemple ajoute un nouvel élément à un onglet Boîte à outils, l'active, puis le supprime, si tel est le choix de l'utilisateur. Pour plus d'informations sur l'exécution de cet exemple comme complément, consultez Comment : compiler et exécuter les exemples de code du modèle objet Automation.

Sub DeleteExample(ByVal dte As DTE2)
    ' Add a new tab to the Toolbox.
    Dim box As ToolBox = dte.ToolWindows.ToolBox
    Dim tab As ToolBoxTab2 = CType(box.ToolBoxTabs.Add _
    ("Sample ToolBoxTab"), ToolBoxTab2)
    ' Add two ToolBoxItem objects to the new Toolbox tab.
    Dim item As ToolBoxItem = _
        tab.ToolBoxItems.Add("Text Item", "Hello, text item!")
    tab.ToolBoxItems.Add("HTML Item", "Hello, HTML item!", _
        vsToolBoxItemFormat.vsToolBoxItemFormatHTML)
    ' Select the "Text Item" ToolBox item.
    box.Parent.AutoHides = False
    box.Parent.Activate()
    tab.Activate()
    item.Select()
    If MsgBox("Delete the selected Toolbox item?", MsgBoxStyle.YesNo) _
        = MsgBoxResult.Yes Then
        item.Delete()
    End If
End Sub
public void DeleteExample(DTE2 dte)
{
    // Add a new tab to the Toolbox.
    ToolBox box = dte.ToolWindows.ToolBox;
    ToolBoxTab2 tab = (ToolBoxTab2)box.ToolBoxTabs.Add
("Sample ToolBoxTab");
    // Add two ToolBoxItem objects to the new Toolbox tab.
    ToolBoxItem item = tab.ToolBoxItems.Add("Text Item", 
        "Hello, text item!", 
        vsToolBoxItemFormat.vsToolBoxItemFormatText);
    tab.ToolBoxItems.Add("HTML Item", "Hello, HTML item!", 
        vsToolBoxItemFormat.vsToolBoxItemFormatHTML);
    // Select the "Text Item" ToolBox item.
    box.Parent.AutoHides = false;
    box.Parent.Activate();
    tab.Activate();
    item.Select();
    if (MessageBox.Show("Delete the selected Toolbox item?", "", 
        MessageBoxButtons.YesNo) == DialogResult.Yes)
        item.Delete();
}

Sécurité .NET Framework

Voir aussi

Référence

ToolBoxTab2 Interface

EnvDTE80, espace de noms