EditPoint2.Delete 方法 (Object)
刪除指定的文字範圍。
命名空間: EnvDTE80
組件: EnvDTE80 (在 EnvDTE80.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
型別:System.Object
必要項。代表 TextPoint 物件或字元數目。
備註
如果 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 安全性
- 完全信任立即呼叫者。這個成員無法供部分信任的程式碼使用。如需詳細資訊,請參閱從部分受信任程式碼使用程式庫。