Método TextSelection.MoveToLineAndOffset

Move o ponto ativo para a posição fornecida.

Namespace:  EnvDTE
Assembly:  EnvDTE (em EnvDTE.dll)

Sintaxe

'Declaração
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: System.Int32
    Obrigatório.A linha de número para mover, começando em um.Linetambém pode ser uma das constantes de vsGoToLineOptions.
  • Offset
    Tipo: System.Int32
    Obrigatório.A posição de índice do caractere na linha, começando em um.
  • Extend
    Tipo: System.Boolean
    Opcional.Padrão = false.Um valor booleano para estender a seleção atual.Se Extend é true, e o final ativo da seleção move para o local, enquanto o fim de âncora permanece onde ele SalomãoCaso contrário, ambas as extremidades são movidas para o local especificado.Este argumento só é aplicável a TextSelection objeto.

Comentários

Se o valor de Offset é o último caractere da linha, além do documento move para o fim da linha.

Exemplos

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

Segurança do .NET Framework

Consulte também

Referência

TextSelection Interface

Namespace EnvDTE