Sdílet prostřednictvím


TextSelection.MoveToLineAndOffset – metoda

Přesune aktivní na dané pozici.

Obor názvů:  EnvDTE
Sestavení:  EnvDTE (v EnvDTE.dll)

Syntaxe

'Deklarace
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
)

Parametry

  • Line
    Typ: Int32

    Požadováno.Řádek číslo přesouvat, počínaje číslem jedna.Linemůže být také jednu z konstant vsGoToLineOptions.

  • Offset
    Typ: Int32

    Požadováno.Indexovou polohu znaku v řádku počínaje číslem jedna.

  • Extend
    Typ: Boolean

    Volitelné.Default = false.Logická hodnota, k rozšíření aktuálního výběru.Pokud Extend je true, a pak přesune aktivní konec výběru umístění při zůstane koncového ukotvení, kde je.Jinak oba konce jsou přesunuty do zadaného umístění.Tento argument se vztahuje pouze TextSelection objektu.

Poznámky

Pokud hodnota Offset je za poslední znak na řádku dokumentu přesune na konec řádku.

Příklady

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

Zabezpečení rozhraní .NET Framework

Viz také

Referenční dokumentace

TextSelection Rozhraní

EnvDTE – obor názvů