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 不會自動在字串中加入新行字元 (Newline Character)。 如果想要字串中有這些字元,必須將這些字元加入至 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 安全性
- 完全信任立即呼叫者。這個成員無法供部分信任的程式碼使用。如需詳細資訊,請參閱從部分受信任程式碼使用程式庫。