OutputWindowPane.OutputTaskItemString 方法

在**“输出”窗口中显示字符串,并将相应的项添加到“任务列表”**。

命名空间:  EnvDTE
程序集:  EnvDTE(在 EnvDTE.dll 中)

语法

声明
Sub OutputTaskItemString ( _
    Text As String, _
    Priority As vsTaskPriority, _
    SubCategory As String, _
    Icon As vsTaskIcon, _
    FileName As String, _
    Line As Integer, _
    Description As String, _
    Force As Boolean _
)
void OutputTaskItemString(
    string Text,
    vsTaskPriority Priority,
    string SubCategory,
    vsTaskIcon Icon,
    string FileName,
    int Line,
    string Description,
    bool Force
)
void OutputTaskItemString(
    [InAttribute] String^ Text, 
    [InAttribute] vsTaskPriority Priority, 
    [InAttribute] String^ SubCategory, 
    [InAttribute] vsTaskIcon Icon, 
    [InAttribute] String^ FileName, 
    [InAttribute] int Line, 
    [InAttribute] String^ Description, 
    [InAttribute] bool Force
)
abstract OutputTaskItemString : 
        Text:string * 
        Priority:vsTaskPriority * 
        SubCategory:string * 
        Icon:vsTaskIcon * 
        FileName:string * 
        Line:int * 
        Description:string * 
        Force:bool -> unit
function OutputTaskItemString(
    Text : String, 
    Priority : vsTaskPriority, 
    SubCategory : String, 
    Icon : vsTaskIcon, 
    FileName : String, 
    Line : int, 
    Description : String, 
    Force : boolean
)

参数

  • Text
    类型:String

    必选。 要添加到**“输出”**窗口中的文本。

  • SubCategory
    类型:String

    必选。 新任务项要使用的子类别。

  • FileName
    类型:String

    必选。 要与新任务项相关联的文件名。 可以为空字符串。

  • Line
    类型:Int32

    必选。 与新任务项相关的代码行。

  • Description
    类型:String

    必选。 新任务项的说明。

  • Force
    类型:Boolean

    可选。 指示**“输出”窗口是否应立刻更新“任务列表”**。 默认值为 True。 如果要添加若干个项,请将 Force 设置为 False,然后在最后一个项上将 Force 设置为 True。

备注

对于要在**“任务列表”中显示的行号,必须在 FileName 参数中指定完整路径。(例如,c:\workfile.txt。)该位置必须存在相应的文件。 原因是,“输出”**窗口会在显示行号前进行检查以确保指定的文件存在。

示例

Sub OutputTaskItemStringExample()
   ' Create a tool window handle for the Output window.
   Dim win As Window = DTE.Windows.Item(EnvDTE.Constants.vsWindowKindOutput)
   ' Create handles to the Output window and its panes.
   Dim OW As OutputWindow = win.Object
   Dim OWp As OutputWindowPane

   ' Add a new pane to the Output window.
   OWp = OW.OutputWindowPanes.Add("A New Pane")
   ' Add a line of text to the new pane and to the Task List.
   OWp.OutputTaskItemString("Some task", vsTaskPriority.vsTaskPriorityHigh, vsTaskCategories.vsTaskCategoryMisc, vsTaskIcon.vsTaskIconComment, "C:\temp", 100, "Some description")
   ' You can also use the 'True' flag on the end of OutputTaskItemString 
   ' rather than using the next line (ForceItemsToTaskList).
   OWp.ForceItemsToTaskList()
End Sub

.NET Framework 安全性

请参阅

参考

OutputWindowPane 接口

EnvDTE 命名空间