Udostępnij za pośrednictwem


Metoda TextSelection.MoveToLineAndOffset —

Przenosi punkt aktywny do danej pozycji.

Przestrzeń nazw:  EnvDTE
Zestaw:  EnvDTE (w EnvDTE.dll)

Składnia

'Deklaracja
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

    Wymagany.Numer wiersza go przenieść, począwszy od jednego.Linemogą również być jedną ze stałych z vsGoToLineOptions.

  • Offset
    Typ: Int32

    Wymagany.Położenie indeksu znaku w wierszu, zaczynając od jednego.

  • Extend
    Typ: Boolean

    Opcjonalnie.Default = false.Wartość logiczna, aby rozszerzyć zaznaczenie bieżącego.Jeśli Extend jest true, następnie przechodzi lokalizacji, podczas gdy pozostaje koniec kotwicy, gdzie jest aktywne końca zaznaczenia.W przeciwnym razie oba końce są przenoszone do określonej lokalizacji.Ten argument stosuje się tylko do TextSelection obiektu.

Uwagi

Jeśli wartość Offset jest poza ostatniego znaku w wierszu dokumentu przechodzi do końca wiersza.

Przykłady

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

Zabezpieczenia programu .NET Framework

Zobacz też

Informacje

TextSelection Interfejs

Przestrzeń nazw EnvDTE