将活动点移到给定位置。
命名空间:  EnvDTE
程序集:  EnvDTE(在 EnvDTE.dll 中)
语法
声明
Sub MoveToLineAndOffset ( _
    Line As Integer, _
    Offset As Integer, _
    Extend As Boolean _
)
void MoveToLineAndOffset(
    int Line,
    int Offset,
    bool Extend
)
void MoveToLineAndOffset(
    [InAttribute] int Line, 
    [InAttribute] int Offset, 
    [InAttribute] bool Extend
)
abstract MoveToLineAndOffset : 
        Line:int * 
        Offset:int * 
        Extend:bool -> unit 
function MoveToLineAndOffset(
    Line : int, 
    Offset : int, 
    Extend : boolean
)
参数
- Line
 类型:System.Int32
 必选。要移至的行号,从 1 开始。Line 也可能是来自 vsGoToLineOptions 的一个常数。
- Offset
 类型:System.Int32
 必选。该行中的字符索引位置,从 1 开始。
- Extend
 类型:System.Boolean
 可选。默认值为 false。扩展当前选定范围的布尔值。如果 Extend 为 true,则选定内容的活动端会移到该位置,而定位端保留在原地。否则,两端都将移动到指定位置。此参数仅适用于 TextSelection 对象。
备注
如果 Offset 的值超出行的最后一个字符,该文档将移动到该行的末尾。
示例
Sub MoveToLineAndOffsetExample()
    ' Before running this example, open a text document.
    Dim objSel As TextSelection = DTE.ActiveDocument.Selection
    ' Move to the beginning of the document so we can iterate over the 
    ' whole thing.
    objSel.StartOfDocument()
    While objSel.FindPattern("#if _DEBUG")
        ' If we found the beginning of a debug-only section, save the 
        ' position.
        Dim lStartLine As Long = objSel.TopPoint.Line
        Dim lStartColumn As Long = objSel.TopPoint.LineCharOffset
        ' Look for the end.
        If objSel.FindPattern("#endif") Then
            ' Select the entire section and outline it.
            objSel.SwapAnchor()
            objSel.MoveToLineAndOffset(lStartLine, lStartColumn, True)
            objSel.OutlineSection()
            objSel.LineDown()
        End If
    End While
End Sub
.NET Framework 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。