OutputWindowPane.TextDocument Eigenschaft

Definition

Ruft das TextDocument-Objekt für den OutputWindowPane ab.

public:
 property EnvDTE::TextDocument ^ TextDocument { EnvDTE::TextDocument ^ get(); };
public:
 property EnvDTE::TextDocument ^ TextDocument { EnvDTE::TextDocument ^ get(); };
[System.Runtime.InteropServices.DispId(10)]
public EnvDTE.TextDocument TextDocument { [System.Runtime.InteropServices.DispId(10)] get; }
[<System.Runtime.InteropServices.DispId(10)>]
[<get: System.Runtime.InteropServices.DispId(10)>]
member this.TextDocument : EnvDTE.TextDocument
Public ReadOnly Property TextDocument As TextDocument

Eigenschaftswert

TextDocument

Ein TextDocument-Objekt.

Attribute

Beispiele

Sub TextDocumentExample(ByVal dte As DTE2)  

    ' Retrieve and show the Output window.  
    Dim outWin As OutputWindow = dte.ToolWindows.OutputWindow  
    outWin.Parent.AutoHides = False  
    outWin.Parent.Activate()  

    ' Find the "Pane1" Output window pane; if it does not exist,   
    ' create it.  
    Dim pane1 As OutputWindowPane  
    Try  
        pane1 = outWin.OutputWindowPanes.Item("Pane1")  
    Catch  
        pane1 = outWin.OutputWindowPanes.Add("Pane1")  
    Finally  
        pane1.Clear()  
    End Try  

    ' Write 10 lines of text to Pane1.  
    Dim i As Integer  
    For i = 1 To 10  
        pane1.OutputString("Line " & i.ToString() & vbCrLf)  
    Next  

    ' Retrieve the text from Pane1.  
    Dim doc As TextDocument = pane1.TextDocument  
    Dim sel As TextSelection = doc.Selection  

    sel.StartOfDocument()  
    sel.EndOfDocument(True)  

    MsgBox("Text in Pane1:" & vbCrLf & vbCrLf & sel.Text)  

End Sub  
public void TextDocumentExample(DTE2 dte)  
{  
    // Retrieve and show the Output window.  
    OutputWindow outWin = dte.ToolWindows.OutputWindow;  
    outWin.Parent.AutoHides = false;  
    outWin.Parent.Activate();  

    // Find the "Pane1" Output window pane; if it does not exist,   
    // create it.  
    OutputWindowPane pane1 = null;  
    try  
    {  
        pane1 = outWin.OutputWindowPanes.Item("Pane1");  
    }  
    catch  
    {  
        pane1 = outWin.OutputWindowPanes.Add("Pane1");  
    }  
    finally  
    {  
        pane1.Clear();  
    }  

    // Write 10 lines of text to Pane1.  
    for (int i = 1; i <= 10; i++)  
        pane1.OutputString("Line " + i.ToString() + "\n");  

    // Retrieve the text from Pane1.  
    TextDocument doc = pane1.TextDocument;  
    TextSelection sel = doc.Selection;  

    sel.StartOfDocument(false);  
    sel.EndOfDocument(true);  

    MessageBox.Show("Text in Pane1:\n\n" + sel.Text);  
}  

Hinweise

Wenn Sie versuchen, das Dokument über diese Eigenschaft oder einen zu ändern, tritt ein Fehler auf, EditPoint weil der gesamte Dokumentbereich schreibgeschützt ist. Sie können das Dokument nur über Mitglieder von ändern CommandWindow .

Gilt für