Share via


TextSelection.MoveToLineAndOffset (Método)

Mueve el punto activo hasta la posición especificada.

Espacio de nombres:  EnvDTE
Ensamblado:  EnvDTE (en EnvDTE.dll)

Sintaxis

'Declaración
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
)

Parámetros

  • Line
    Tipo: Int32

    Obligatorio. El número de línea a la que se va a desplazar, comenzando en uno. Line también puede ser una de las constantes de vsGoToLineOptions.

  • Offset
    Tipo: Int32

    Obligatorio. Posición del índice de carácter en esa línea, a partir de uno.

  • Extend
    Tipo: Boolean

    Opcional. El valor predeterminado es false. Valor booleano para extender la selección actual. Si el parámetro Extend es true, el extremo activo de la selección se desplaza a la ubicación, mientras que el extremo de delimitación permanece donde está. En caso contrario, ambos extremos se desplazan a la posición especificada. Este argumento sólo se aplica al objeto TextSelection.

Comentarios

Si el valor del parámetro Offset se encuentra más allá del último carácter de la línea, el documento se desplaza al final de ésta.

Ejemplos

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

Seguridad de .NET Framework

Vea también

Referencia

TextSelection Interfaz

EnvDTE (Espacio de nombres)