TextSelection.MoveToAbsoluteOffset(Int32, Boolean) 方法

定义

按给定的从 1 开始的绝对字符偏移量移动活动点。

void MoveToAbsoluteOffset(int Offset, bool Extend = false);
[System.Runtime.InteropServices.DispId(40)]
public void MoveToAbsoluteOffset (int Offset, bool Extend = false);
[<System.Runtime.InteropServices.DispId(40)>]
abstract member MoveToAbsoluteOffset : int * bool -> unit
Public Sub MoveToAbsoluteOffset (Offset As Integer, Optional Extend As Boolean = false)

参数

Offset
Int32

必需。 从文档开头开始的字符索引,从 1 开始。

Extend
Boolean

可选。 默认值 = false。 扩展当前选定范围的布尔值。 如果 Extendtrue ,则选定内容的活动端会移到该位置,而定位端保留在该位置。 否则,两端都会移动到指定位置。 此参数仅适用于 TextSelection 对象。

属性

示例

Sub MoveToAbsoluteOffsetExample()  
   ' 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)  
   ' Move to various lines and offsets (character columns).  
   objSel.MoveToAbsoluteOffset(3, True)  
   objSel.MoveToDisplayColumn(3, True)  
End Sub  

适用于