Metodo ToolBoxTab.Activate

Consente di spostare lo stato attivo sull'elemento corrente.

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

Sintassi

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

Note

quando Activate viene richiamato, è come se l'utente ha fatto clic sull'elemento, ma nessun evento Click si è verificato.

Esempi

Sub ActivateExample(ByVal dte As DTE2)

    ' Add a new tab to the ToolBox.
    Dim box As ToolBox = dte.ToolWindows.ToolBox
    Dim tab As ToolBoxTab = box.ToolBoxTabs.Add("Sample ToolBoxTab")

    ' 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 ActivateExample(DTE2 dte)
{
    // Add a new tab to the ToolBox.
    ToolBox box = dte.ToolWindows.ToolBox;
    ToolBoxTab tab = 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

ToolBoxTab Interfaccia

Spazio dei nomi EnvDTE

Altre risorse

Procedura: compilare ed eseguire gli esempi di codice del modello a oggetti di automazione