Aracılığıyla paylaş


Nasıl yapılır: Output penceresi kontrol

Çıkış pencere tümleşik geliştirme ortamı (IDE) çeşitli özellikler için durum iletileri görüntüler. Hedef veritabanında saklı yordam içindeki Transact-sql sözdizimi işaretlendiğinde bir projesi derlendiði zaman oluşan derleme hataları ve sonuçları bunlar. Bazı IDE özellikleri gibi özellikleri veya içindeki çağrılan komutlar dış Araçları komut penceresinde, özel teslim çıkışı çıktı Pencere bölmeleri. Dış Araçları'ndan çıktı, örneğin, .bat veya genelde Windows komut istemi penceresinde görüntülenir, .com dosyaları da görüntülenebilir Çıkış pencere.

Visual Studio Otomasyon modeli sunar denetlemek için kullanabileceğiniz aşağıdaki nesneler Çıkış pencere.

Nesne adı

Description

OutputWindow

Temsil Çıkış pencere.

OutputWindowPanes

Tümünü içeren bir koleksiyon Çıkış Pencere bölmeleri.

OutputWindowPane

Yalnızca bir bölmede temsil Çıkış pencere.

OutputWindowEvents

Oluşan olaylara yanıt olanak Çıkış pencere.

İçeriğini denetleme ek olarak Çıkış penceresinde, yükseklik ve genişlik gibi özellikleri de denetleyebilirsiniz. Daha fazla bilgi için bkz. Nasıl yapılır: pencere özelliklerini değiştirme.

İçindeki metni çıktı pencere bölmelerinin yönetilen kullanarak Visual Studio düzenleyen otomasyon modeli, kullanarak kodu kod düzenleyicisine ettirilebilen gibi TextDocument nesnesi, EditPoint nesne veya benzer nesneleri. Daha fazla bilgi için bkz. Nasıl yapılır: Code Editor (Visual Basic) kontrol.

Not

Gördüğünüz iletişim kutuları ve menü komutları, etkin ayarlarınıza ve ürün sürümüne bağlı olarak Yardım menüsünde açıklanana göre farklılık gösterebilir.Bu yordamlar, genel geliştirme ayarları ile etkin geliştirilmiştir.Ayarlarınızı değiştirmek için tıklatın Al ve Verayarları üzerinde araçları menü.Daha fazla bilgi için bkz. Visual Studio ayarları.

Örnek

Bu örnek yeni bir pencere bölmesine eklemek gösterilmiştir Çıkış pencere ve nasıl şeyler ekleyebilirsiniz. Örnek çalıştırma hakkında daha fazla bilgi için bkz: Nasıl yapılır: derlemek ve Otomasyon nesne modeli kod örneklerini çalıştırmak.

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)
    ' Pass the applicationObject member variable to the code example.
    OutputWindowTest(_applicationObject)
End Sub

Sub OutputWindowTest(ByVal dte As DTE2)
    ' Create a tool window reference for the Output window
    ' and window pane.
    Dim ow As OutputWindow = dte.ToolWindows.OutputWindow
    Dim owP As OutputWindowPane

    ' Add a new pane to the Output window.
    owP = ow.OutputWindowPanes.Add("A New Pane")
    ' Add a line of text to the new pane.
    owP.OutputString("Some Text")
End Sub
public void OnConnection(object application, ext_ConnectMode 
  connectMode, object addInInst, ref Array custom)
{
    _applicationObject = (DTE2)application;
    _addInInstance = (AddIn)addInInst;
    // Pass the applicationObject member variable to the code example.
    OutputWindowTest(_applicationObject);
}

public void OutputWindowTest(DTE2 dte)
{
    // Create a tool window reference for the Output window
    // and window pane.
    OutputWindow ow = dte.ToolWindows.OutputWindow;
    OutputWindowPane owP;

    // Add a new pane to the Output window.
    owP = ow.OutputWindowPanes.Add("A New Pane");
    // Add a line of text to the new pane.
    owP.OutputString("Some Text");
}

Bu örnek metni ekler Build bölmesinde Çıkış pencere ve onu alır.

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)
    ' Pass the applicationObject member variable to the code example.
    writeReadOW(_applicationObject)
End Sub

Sub writeReadOW(ByVal dte As DTE2)
    ' Add-in code.
    ' Create a reference to the Output window.
    ' Create a tool window reference for the Output window
    ' and window pane.
    Dim ow As OutputWindow = dte.ToolWindows.OutputWindow
    Dim owP As OutputWindowPane
    ' Create a reference to the pane contents.
    Dim owPTxtDoc As TextDocument

    ' Select the Build pane in the Output window.
    owP = ow.OutputWindowPanes.Item("Build")
    owP.Activate()
    owPTxtDoc = owP.TextDocument

    ' Put some text in the pane.
    owP.OutputString("Testing 123.")
    ' Retrieve the text contents of the pane.
    MsgBox("Startpoint: " & owPTxtDoc.StartPoint.DisplayColumn)
    MsgBox(owPTxtDoc.StartPoint.CreateEditPoint. _
      GetText(owPTxtDoc.EndPoint))
End Sub
using System.Windows.Forms;
public void OnConnection(object application, ext_ConnectMode 
  connectMode, object addInInst, ref Array custom)
{
    _applicationObject = (DTE2)application;
    _addInInstance = (AddIn)addInInst;
    // Pass the applicationObject member variable to the code example.
    writeReadOW(_applicationObject);
}

public void writeReadOW(DTE2 dte)
{
    // Add-in code.
    // Create a reference to the Output window.
    // Create a tool window reference for the Output window
    // and window pane.
    OutputWindow ow = dte.ToolWindows.OutputWindow;
    OutputWindowPane owP;
    // Create a reference to the pane contents.
    TextDocument owPTxtDoc;
    EditPoint2 strtPt;

    // Select the Build pane in the Output window.
    owP = ow.OutputWindowPanes.Item("Build");
    owP.Activate();
    owPTxtDoc = owP.TextDocument;
            
    // Put some text in the pane.
    owP.OutputString("Testing 123.");
    // Retrieve the text contents of the pane.
    System.Windows.Forms.MessageBox.Show("Startpoint: " + 
      owPTxtDoc.StartPoint.DisplayColumn);
    strtPt = (EditPoint2)owPTxtDoc.StartPoint.CreateEditPoint();
    System.Windows.Forms.MessageBox.Show
      (strtPt.GetText(owPTxtDoc.EndPoint));
}

Ayrıca bkz.

Görevler

Nasıl yapılır: pencere özelliklerini değiştirme

Nasıl yapılır: bir eklenti oluşturmak

İzlenecek yol: bir sihirbaz oluşturma

Kavramlar

Otomasyon nesne modeli şeması

Diğer Kaynaklar

Oluşturma ve ortam Windows denetleme

Eklentiler ve sihirbazlar oluşturma

Otomasyon ve Genişletilebilirlik Başvurusu