共用方式為


EditPoint.Delete 方法

刪除指定的文字範圍。

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

語法

'宣告
Sub Delete ( _
    PointOrCount As Object _
)
void Delete(
    Object PointOrCount
)
void Delete(
    [InAttribute] Object^ PointOrCount
)
abstract Delete : 
        PointOrCount:Object -> unit 
function Delete(
    PointOrCount : Object
)

參數

備註

如果 PointOrCount 是 TextPoint 物件,Delete 會刪除介於編輯點和 PointOrCount 之間的文字。 如果 PointOrCount 是整數,則 Delete 會刪除從編輯點開始直到編輯點之後指定字元數目的文字,每行結尾的隱含新行序列都算一個字元。

如果 PointOrCount 是負值,則 Delete 會刪除編輯點前面的文字。

範例

Sub DeleteExample()
   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
        
   ' Change the first letter of the fourth word of the fourth line.
   objEditPt.StartOfDocument()
   objEditPt.LineDown(3)
   objEditPt.WordRight(3)
   objEditPt.CharRight(2)
   objEditPt.Charleft(2)
   objeditpt.Delete(1)
   objEditPt.Insert("p")
End Sub

.NET Framework 安全性

請參閱

參考

EditPoint 介面

EnvDTE 命名空間