CommandWindow.OutputString 方法
将文本字符串发送到**“命令”**窗口。
命名空间: EnvDTE
程序集: EnvDTE(在 EnvDTE.dll 中)
语法
声明
Sub OutputString ( _
Text As String _
)
void OutputString(
string Text
)
void OutputString(
String^ Text
)
abstract OutputString :
Text:string -> unit
function OutputString(
Text : String
)
参数
- Text
类型:System.String
必选。发送到窗口的文本字符。
备注
OutputString 不会自动在字符串中添加换行符。 如果要在字符串中包含换行符,则必须将它们添加到 Text 中。
示例
Sub CommandWinExample(ByVal dte As DTE)
' Get a reference to the Command window.
Dim win As Window = _
DTE.Windows.Item(EnvDTE.Constants.vsWindowKindCommandWindow)
Dim CW As CommandWindow = win.Object
' Input a command into the Command window and execute it.
CW.SendInput("nav https://www.microsoft.com", False)
' Insert some information text into the Command window.
CW.OutputString("This URL takes you to the main Microsoft _
website.")
' Clear the contents of the Command window.
MsgBox("Clearing the Command window...")
CW.Clear()
End Sub
void CommandWinExample(_DTE dte)
{
// Get a reference to the Command window.
Window win =
dte.Windows.Item(EnvDTE.Constants.vsWindowKindCommandWindow);
CommandWindow CW = (CommandWindow)win.Object;
// Input a command into the Command window and execute it.
CW.SendInput("nav https://www.microsoft.com", false);
// Insert some information text into the Command window.
CW.OutputString("This URL takes you to the main Microsoft
website.");
// Clear the contents of the Command window.
MessageBox.Show("Clearing the Command window...");
CW.Clear();
}
.NET Framework 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。