EditPoint.GetText 方法

取得緩衝區中介於目前位置與指定位置之間的文字。

命名空間:  EnvDTE
組件:  EnvDTE (在 EnvDTE.dll 中)

語法

'宣告
Function GetText ( _
    PointOrCount As Object _
) As String
string GetText(
    Object PointOrCount
)
String^ GetText(
    [InAttribute] Object^ PointOrCount
)
abstract GetText : 
        PointOrCount:Object -> string 
function GetText(
    PointOrCount : Object
) : String

參數

傳回值

型別:System.String
緩衝區中介於目前位置與指定之位置之間的文字字串。

備註

GetText 傳回代表介於編輯點與 PointOrCount 之間的文字的字串。 如果引數是整數,則 GetText 會傳回代表編輯點之後指定字元數目的字串,每行結尾的隱含新行序列都算一個字元。

如果引數是負值,則 GetText 會傳回編輯點前面的文字。

範例

Sub GetTextExample()
   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 GetText: " & Chr(13) & objeditpt.GetText(4))
End Sub

.NET Framework 安全性

請參閱

參考

EditPoint 介面

EnvDTE 命名空間