Share via


EditPoint.GetLines 方法

获取表示两个给定行之间的文本的字符串。

命名空间:  EnvDTE
程序集:  EnvDTE(在 EnvDTE.dll 中)

语法

声明
Function GetLines ( _
    Start As Integer, _
    ExclusiveEnd As Integer _
) As String
string GetLines(
    int Start,
    int ExclusiveEnd
)
String^ GetLines(
    [InAttribute] int Start, 
    [InAttribute] int ExclusiveEnd
)
abstract GetLines : 
        Start:int * 
        ExclusiveEnd:int -> string
function GetLines(
    Start : int, 
    ExclusiveEnd : int
) : String

参数

  • Start
    类型:Int32

    可选。 第一个要包含其文本的行的行号。

  • ExclusiveEnd
    类型:Int32

    必需。 最后一个要包含其文本的行的行号。

返回值

类型:String
两个给定行之间的文本。

备注

返回的字符串表示 Start(含)和 ExclusiveEnd(不含)之间的文本。 字符串包含行边界换行符(ACSII 码 13),如果最后一行以换行符结尾则以换行符结束。

示例

Sub GetLinesExample()
   Dim objTextDoc As TextDocument
   Dim objEditPt As EditPoint, iCtr As Integer
        
   ' Create a new text file.
   DTE.ItemOperations.NewFile("General\Text File")
        
   ' Get a handle to the new document and create an EditPoint.
   objTextDoc = DTE.ActiveDocument.Object("TextDocument")
   objEditPt = objTextDoc.StartPoint.CreateEditPoint
        
   ' Insert ten lines of text.
   For iCtr = 1 To 10
      objeditpt.Insert("This is a test." & Chr(13))
   Next iCtr
   objEditPt.StartOfDocument()
   msgbox("The results of GetLines: " & Chr(13) & objeditpt.GetLines(1, 6))
End Sub

.NET Framework 安全性

请参阅

参考

EditPoint 接口

EnvDTE 命名空间