次の方法で共有


OutputWindowPane.Clear メソッド

OutputWindowPane のすべてのテキストを消去します。

名前空間:  EnvDTE
アセンブリ:  EnvDTE (EnvDTE.dll 内)

構文

'宣言
Sub Clear
void Clear()
void Clear()
abstract Clear : unit -> unit 
function Clear()

解説

単一のペインのすべてのテキストを消去します。

Sub ClearExample(ByVal dte As DTE2)

    ' Retrieve the Output window.
    Dim outputWin As OutputWindow = dte.ToolWindows.OutputWindow

    ' Find the "Test Pane" Output window pane; if it does not exist, 
    ' create it.
    Dim pane As OutputWindowPane
    Try
        pane = outputWin.OutputWindowPanes.Item("Test Pane")
    Catch
        pane = outputWin.OutputWindowPanes.Add("Test Pane")
    End Try

    ' Show the Output window and activate the new pane.
    outputWin.Parent.AutoHides = False
    outputWin.Parent.Activate()
    pane.Activate()

    ' Add a line of text to the new pane.
    pane.OutputString("Some text." & vbCrLf)

    If MsgBox("Clear the Output window pane?", MsgBoxStyle.YesNo) = _
        MsgBoxResult.Yes Then
        pane.Clear()
    End If

End Sub
public void ClearExample(DTE2 dte)
{
    // Retrieve the Output window.
    OutputWindow outputWin = dte.ToolWindows.OutputWindow;

    // Find the "Test Pane" Output window pane; if it doesn't exist, 
    // create it.
    OutputWindowPane pane = null;
    try
    {
        pane = outputWin.OutputWindowPanes.Item("Test Pane");
    }
    catch
    {
        pane = outputWin.OutputWindowPanes.Add("Test Pane");
    }

    // Show the Output window and activate the new pane.
    outputWin.Parent.AutoHides = false;
    outputWin.Parent.Activate();
    pane.Activate();

    // Add a line of text to the new pane.
    pane.OutputString("Some text." + "\r\n");

    if (MessageBox.Show("Clear the Output window pane?", "", 
        MessageBoxButtons.YesNo) == DialogResult.Yes)
        pane.Clear();
}

.NET Framework セキュリティ

  • 直前の呼び出し元に対する完全な信頼。このメンバーは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。

参照

関連項目

OutputWindowPane インターフェイス

EnvDTE 名前空間

その他の技術情報

方法 : オートメーション オブジェクト モデルのコード例をコンパイルおよび実行する