ITextCaret.MoveTo Method (ITextViewLine, Double, Boolean)

Moves the caret to the best CaretPosition for the specified x-coordinate and text line.

Namespace:  Microsoft.VisualStudio.Text.Editor
Assembly:  Microsoft.VisualStudio.Text.UI (in Microsoft.VisualStudio.Text.UI.dll)

Syntax

声明
Function MoveTo ( _
    textLine As ITextViewLine, _
    xCoordinate As Double, _
    captureHorizontalPosition As Boolean _
) As CaretPosition
CaretPosition MoveTo(
    ITextViewLine textLine,
    double xCoordinate,
    bool captureHorizontalPosition
)
CaretPosition MoveTo(
    ITextViewLine^ textLine, 
    double xCoordinate, 
    bool captureHorizontalPosition
)
abstract MoveTo : 
        textLine:ITextViewLine * 
        xCoordinate:float * 
        captureHorizontalPosition:bool -> CaretPosition 
function MoveTo(
    textLine : ITextViewLine, 
    xCoordinate : double, 
    captureHorizontalPosition : boolean
) : CaretPosition

Parameters

  • xCoordinate
    Type: System.Double
    The x-coordinate of the caret in the text rendering coordinate system.
  • captureHorizontalPosition
    Type: System.Boolean
    true if the caret should capture its horizontal position for subsequent moves up or down, false if the caret should retain its previously-captured horizontal position.

Return Value

Type: Microsoft.VisualStudio.Text.Editor.CaretPosition
A CaretPosition that contains the valid values of the caret after the move has occurred.

Exceptions

Exception Condition
ArgumentOutOfRangeException

xCoordinate is NaN.

Remarks

This method takes care of UTF-16 surrogate pairs and combining character sequences.

.NET Framework Security

See Also

Reference

ITextCaret Interface

MoveTo Overload

Microsoft.VisualStudio.Text.Editor Namespace