Condividi tramite


Interfaccia ToolWindows

Migliora l'esposizione e l'utilizzo delle finestre degli strumenti nel modello a oggetti semplificando l'accesso alle finestre degli strumenti della shell nei relativi tipi nativi.

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

Sintassi

'Dichiarazione
<GuidAttribute("19AC6F68-3019-4D65-8D98-404DFB96B8E2")> _
Public Interface ToolWindows
[GuidAttribute("19AC6F68-3019-4D65-8D98-404DFB96B8E2")]
public interface ToolWindows
[GuidAttribute(L"19AC6F68-3019-4D65-8D98-404DFB96B8E2")]
public interface class ToolWindows
[<GuidAttribute("19AC6F68-3019-4D65-8D98-404DFB96B8E2")>]
type ToolWindows =  interface end
public interface ToolWindows

Il tipo ToolWindows espone i seguenti membri.

Proprietà

  Nome Descrizione
Proprietà pubblica CommandWindow Ottiene l'oggetto CommandWindow.
Proprietà pubblica DTE Ottiene l'oggetto estensibilità di primo livello.
Proprietà pubblica ErrorList Ottiene l'elenco degli errori visualizzati nell'IDE.
Proprietà pubblica OutputWindow Ottiene l'oggetto OutputWindow.
Proprietà pubblica SolutionExplorer Ottiene un oggetto UIHierarchy che rappresenta Esplora soluzioni.
Proprietà pubblica TaskList Ottiene l'oggetto TaskList.
Proprietà pubblica ToolBox Ottiene l'oggetto ToolBox.

In alto

Metodi

  Nome Descrizione
Metodo pubblico GetToolWindow Consente all'utente di recuperare una finestra in base al titolo.

In alto

Note

Le finestre degli strumenti di Visual Studio sono accessibili attraverso le proprietà dei membri. Altre finestre degli strumenti possono essere individuate mediante la funzione GetToolWindow.

Esempi

In questo esempio viene aggiunta e attivata una Finestra di output dal titolo "My output" e vengono visualizzate tutte le finestre degli strumenti raggiunte mediante l'oggetto Collection dell'oggetto padre ToolWindows. 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
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)
    OutputToolWindow(_applicationObject)
End Sub
Public Sub OutputToolWindow(ByVal dte As DTE2)
    Dim myOut As OutputWindow
    myOut = _applicationObject.ToolWindows.OutputWindow
    Dim myPane As OutputWindowPane
    Dim txt As String
    txt = ""
    MsgBox("Creating an output window.")
    myPane = myOut.OutputWindowPanes.Add("My output")
    myPane.Activate()
    MsgBox("Adding some text to the output window...")
    myPane.OutputString("This is the collection of tool windows, _
 reached through the Output Window object:" & vbCr)
    For Each tempWindow As EnvDTE80.Window2 In myOut.Parent.Collection
        txt = txt & (tempWindow.Caption & vbCr)
    Next tempWindow
    MsgBox("Displaying all the tool window captions _
 in the Output window...")
    myPane.OutputString(txt)
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;
    OutputToolWindow(_applicationObject);
}
public void OutputToolWindow(DTE2 dte)
{
    OutputWindow myOut;
    myOut = _applicationObject.ToolWindows.OutputWindow;
    OutputWindowPane myPane;
    String txt = null;
    MessageBox.Show("Creating an output window.");
    myPane = myOut.OutputWindowPanes.Add("My output");
    myPane.Activate();
    MessageBox.Show("Adding some text to the output window...");
    myPane.OutputString("This is the collection of tool
 windows,reached through the Output Window object:" + "\n");
    foreach (EnvDTE80.Window2 tempWindow in myOut.Parent.Collection)
    {
        txt = txt + (tempWindow.Caption + "\n");
    }
    MessageBox.Show("Displaying all the tool window captions 
in the output window...");
    myPane.OutputString(txt);
}

Vedere anche

Riferimenti

Spazio dei nomi EnvDTE80