EditPoint2.GetText 方法 (Object)

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

命名空間:  EnvDTE80
組件:  EnvDTE80 (在 EnvDTE80.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
緩衝區中介於目前位置與指定之位置之間的文字字串。

實作

EditPoint.GetText(Object)

備註

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

如果引數為負值,則 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 安全性

請參閱

參考

EditPoint2 介面

GetText 多載

EnvDTE80 命名空間