Partager via


ITextCaret.MoveTo Method (ITextViewLine, Double)

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

'Declaration
Function MoveTo ( _
    textLine As ITextViewLine, _
    xCoordinate As Double _
) As CaretPosition
CaretPosition MoveTo(
    ITextViewLine textLine,
    double xCoordinate
)
CaretPosition MoveTo(
    ITextViewLine^ textLine, 
    double xCoordinate
)
abstract MoveTo : 
        textLine:ITextViewLine * 
        xCoordinate:float -> CaretPosition
function MoveTo(
    textLine : ITextViewLine, 
    xCoordinate : double
) : CaretPosition

Parameters

  • xCoordinate
    Type: Double

    The x-coordinate of the caret in the text rendering coordinate system.

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 is equivalent to calling MoveTo(textLine, xCoordinate, true).

.NET Framework Security

See Also

Reference

ITextCaret Interface

MoveTo Overload

Microsoft.VisualStudio.Text.Editor Namespace