ITextCaret.MoveTo Method (VirtualSnapshotPoint, PositionAffinity, Boolean)
Moves the caret to the specified buffer position.
Namespace: Microsoft.VisualStudio.Text.Editor
Assembly: Microsoft.VisualStudio.Text.UI (in Microsoft.VisualStudio.Text.UI.dll)
Syntax
'宣言
Function MoveTo ( _
bufferPosition As VirtualSnapshotPoint, _
caretAffinity As PositionAffinity, _
captureHorizontalPosition As Boolean _
) As CaretPosition
CaretPosition MoveTo(
VirtualSnapshotPoint bufferPosition,
PositionAffinity caretAffinity,
bool captureHorizontalPosition
)
CaretPosition MoveTo(
VirtualSnapshotPoint bufferPosition,
PositionAffinity caretAffinity,
bool captureHorizontalPosition
)
abstract MoveTo :
bufferPosition:VirtualSnapshotPoint *
caretAffinity:PositionAffinity *
captureHorizontalPosition:bool -> CaretPosition
function MoveTo(
bufferPosition : VirtualSnapshotPoint,
caretAffinity : PositionAffinity,
captureHorizontalPosition : boolean
) : CaretPosition
Parameters
- bufferPosition
Type: Microsoft.VisualStudio.Text.VirtualSnapshotPoint
The VirtualSnapshotPoint in the underlying text buffer to which to move the caret.
- caretAffinity
Type: Microsoft.VisualStudio.Text.PositionAffinity
The affinity of the caret. This will be ignored unless bufferPosition specifies a location that is at the seam between two word-wrapped lines.
- captureHorizontalPosition
Type: System.Boolean
If true, the caret captures its horizontal position for subsequent moves up or down, if false, the caret retains its previously-captured horizontal position.
Return Value
Type: Microsoft.VisualStudio.Text.Editor.CaretPosition
A CaretPosition that contains the valid values of the caret position after the move has occurred.
Remarks
This method handles UTF-16 surrogate pairs and combining character sequences.
For example, if the text buffer consists of a high surrogate character at index 0 and a low surrogate character at index 1, and bufferPosition is 1 and caretAffinity is Successor, the actual valid caret index is 0 (since the high surrogate and low surrogate characters form one text element).
If caretAffinity is Predecessor, the actual valid caret index is 2.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.