مشاركة عبر


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
    النوع: System.Int32
    مطلوبة.رقم السطر إلى تحريك إلى، البداية في واحد.Lineقد يكون واحد الثوابت منvsGoToLineOptions.
  • Offset
    النوع: System.Int32
    مطلوبة.حرف فهرسة الموقع في الخط، بدءاً من واحد.
  • Extend
    النوع: System.Boolean
    اختياري.الوضع الافتراضي = false.القيمة منطقية إلى توسيع الحل الحالي.إذا Extendهو true، ثم نشط ينقل إنهاء تحديد إلى الموقع، بينما تبقى النهاية الارتساء حيث أنه is.وإلا، يتم نقل كلا الطرفين إلى الموقع المحدد.تنطبق هذه وسيطة فقط إلى 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 واجهة

TextSelection الأعضاء

EnvDTE مساحة الاسم