TextSelection.MoveToLineAndOffset(Int32, Int32, Boolean) Método
Definição
Importante
Algumas informações se referem a produtos de pré-lançamento que podem ser substancialmente modificados antes do lançamento. A Microsoft não oferece garantias, expressas ou implícitas, das informações aqui fornecidas.
Move o ponto ativo para a posição especificada.
void MoveToLineAndOffset(int Line, int Offset, bool Extend = false);
[System.Runtime.InteropServices.DispId(39)]
public void MoveToLineAndOffset (int Line, int Offset, bool Extend = false);
[<System.Runtime.InteropServices.DispId(39)>]
abstract member MoveToLineAndOffset : int * int * bool -> unit
Public Sub MoveToLineAndOffset (Line As Integer, Offset As Integer, Optional Extend As Boolean = false)
Parâmetros
- Line
- Int32
Obrigatórios. O número de linha para o qual mover, começando em um. A linha também pode ser uma das constantes de vsGoToLineOptions .
- Offset
- Int32
Obrigatórios. A posição do índice de caracteres na linha, começando em um.
- Extend
- Boolean
Opcional. Padrão = false. Um valor booliano para estender a seleção atual. Se Extend for true , a extremidade ativa da seleção será movida para o local, enquanto a extremidade da âncora permanecerá onde ela está. Caso contrário, ambas as extremidades serão movidas para o local especificado. Esse argumento aplica-se somente ao TextSelection objeto.
- Atributos
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
Comentários
Se o valor de Offset estiver além do último caractere da linha, o documento será movido para o final da linha.