Condividi tramite


Metodo ToolBoxTab3.Delete

Rimuove l'oggetto ToolBoxTab3 da un insieme.

Spazio dei nomi:  EnvDTE90
Assembly:  EnvDTE90 (in EnvDTE90.dll)

Sintassi

'Dichiarazione
Sub Delete
void Delete()
void Delete()
abstract Delete : unit -> unit 
function Delete()

Implementa

ToolBoxTab2.Delete()

Note

In questo esempio viene aggiunto a una scheda Casella degli strumenti un nuovo elemento, che viene quindi attivato e infine eliminato in base alle scelte dell'utente. Per ulteriori informazioni sulla modalità di esecuzione di questo esempio come componente aggiuntivo, vedere Procedura: compilare ed eseguire gli esempi di codice del modello a oggetti di automazione.

Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
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)
    ActivateExample(_applicationObject)
End Sub
Sub ActivateExample(ByVal dte As DTE2)
    ' Add a new tab to the Toolbox.
    Dim box As ToolBox = dte.ToolWindows.ToolBox
    Dim tab As ToolBoxTab3 = CType(box.ToolBoxTabs.Add _
    ("Sample ToolBoxTab"),ToolBoxTab3)
    ' 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
using EnvDTE;
using EnvDTE80;
using EnvDTE90;
using System.Windows.Forms;
public void OnConnection(object application, 
ext_ConnectMode connectMode, object addInInst, ref Array custom)
{
    _applicationObject = (DTE2)application;
    _addInInstance = (AddIn)addInInst;
    ActivateExample(_applicationObject);
}
public void ActivateExample(DTE2 dte)
{
    // Add a new tab to the Toolbox.
    ToolBox box = dte.ToolWindows.ToolBox;
    ToolBoxTab3 tab = (ToolBoxTab3)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();
}

Sicurezza di .NET Framework

Vedere anche

Riferimenti

ToolBoxTab3 Interfaccia

Overload Delete

Spazio dei nomi EnvDTE90