TextSelection.GotoLine 方法

移动到所指示行的开头,如果请求则选择该行。

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

语法

声明
Sub GotoLine ( _
    Line As Integer, _
    Select As Boolean _
)
void GotoLine(
    int Line,
    bool Select
)
void GotoLine(
    [InAttribute] int Line, 
    [InAttribute] bool Select
)
abstract GotoLine : 
        Line:int * 
        Select:bool -> unit
function GotoLine(
    Line : int, 
    Select : boolean
)

参数

  • Line
    类型:Int32

    必需。 要移至的行号,从 1 开始。

  • Select
    类型:Boolean

    可选。 指示是否应选定目标行。 默认值为 false。

备注

GotoLine 的作用与 TextSelection.MoveToLineAndOffset(Line, 0, False) 一样。 如果 Select 为 true,则 GotoLine 也执行 EndOfLine(True)。

示例

Sub GotoLineExample()
   ' Before running this example, open a text document.
   Dim objSel As TextSelection = DTE.ActiveDocument.Selection
   ' Go to first line in document and select it.
   objSel.GotoLine(1, True)
End Sub

.NET Framework 安全性

请参阅

参考

TextSelection 接口

EnvDTE 命名空间