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 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关详细信息,请参阅通过部分受信任的代码使用库。