TextSelection.MoveToLineAndOffset 메서드

활성 지점을 지정한 위치로 이동합니다.

네임스페이스:  EnvDTE
어셈블리:  EnvDTE(EnvDTE.dll)

구문

‘선언
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
)

매개 변수

  • Line
    형식: Int32

    필수 요소. 이동할 줄 번호로 1부터 시작합니다. Line은 vsGoToLineOptions의 상수 중 하나일 수도 있습니다.

  • Offset
    형식: Int32

    필수 요소. 줄에서 1부터 시작하는 문자 인덱스 위치입니다.

  • Extend
    형식: Boolean

    선택적 요소. 기본값은 false입니다. 현재 선택을 확장하는 부울값입니다. Extend가 true이면 선택 영역의 활성 끝이 해당 위치로 이동하고 앵커 끝은 현재 위치를 유지합니다. 그렇지 않으면 양 끝은 지정한 위치로 옮겨집니다. 이 인수는 TextSelection 개체에만 적용됩니다.

설명

Offset 값이 줄의 마지막 문자를 넘으면 문서가 줄의 끝으로 이동합니다.

예제

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

.NET Framework 보안

참고 항목

참조

TextSelection 인터페이스

EnvDTE 네임스페이스