Compartilhar via


Interface ToolWindows

Melhora a capacidade de descoberta e a usabilidade das janelas de ferramentas no modelo de objeto, fornecendo acesso fácil às janelas de ferramentas do shell em seus tipos nativos.

Namespace:  EnvDTE80
Assembly:  EnvDTE80 (em EnvDTE80.dll)

Sintaxe

'Declaração
<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

O tipo ToolWindows expõe os membros a seguir.

Propriedades

  Nome Descrição
Propriedade pública CommandWindow Obtém o CommandWindow objeto.
Propriedade pública DTE Obtém o objeto de extensibilidade de nível superior.
Propriedade pública ErrorList Obtém a lista de erros exibidos no IDE.
Propriedade pública OutputWindow Obtém o OutputWindow objeto.
Propriedade pública SolutionExplorer Obtém um UIHierarchy objeto representando Solution Explorer.
Propriedade pública TaskList Obtém o TaskList objeto.
Propriedade pública ToolBox Obtém o ToolBox objeto.

Superior

Métodos

  Nome Descrição
Método público GetToolWindow Permite ao usuário recuperar uma janela pelo título.

Superior

Comentários

Janelas de ferramentas de Visual Studio podem ser acessadas através das propriedades membro. Outras janelas de ferramenta podem ser localizadas com o GetToolWindow função.

Exemplos

Este exemplo adiciona um Janela de saída, intitulado "Minha saída", o ativa e exibe todas as janelas de ferramenta são alcançadas através do Collection objeto do pai ToolWindows objeto. Para obter mais informações sobre como executar este exemplo como um add-in, consulte Como compilar e executar os exemplos de código do modelo de objeto Automation.

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);
}

Consulte também

Referência

Namespace EnvDTE80