EditPoint2.Cut 方法 (Object, Boolean)

將指定的文字範圍複製到剪貼簿,並從文件中將其刪除。

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

語法

'宣告
Sub Cut ( _
    PointOrCount As Object, _
    Append As Boolean _
)
void Cut(
    Object PointOrCount,
    bool Append
)
void Cut(
    [InAttribute] Object^ PointOrCount, 
    [InAttribute] bool Append
)
abstract Cut : 
        PointOrCount:Object * 
        Append:bool -> unit 
function Cut(
    PointOrCount : Object, 
    Append : boolean
)

參數

  • Append
    型別:System.Boolean
    選擇項。指出是否要將選取的文字附加到剪貼簿。預設值為 false。

實作

EditPoint.Cut(Object, Boolean)

備註

如果 PointOrCount 是 TextPoint 物件,Cut 會剪下介於編輯點與 PointOrCount 之間的文字,並將它放置到剪貼簿上。 如果 PointOrCount 是整數,則 Cut 會從編輯點後面開始,剪下所指定的編輯點後字元數 (每行結尾隱含的新行序列都算一個字元)。 如果 PointOrCount 為負值,則 Cut 會剪下編輯點之前的文字。

如果 Append 為 true,則 Cut 會將選取範圍附加到目前的剪貼簿內容,而不是取代它。

範例

Sub CutExample()
   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
        
   ' Copies the fourth word of the fourth line, pastes it, 
   ' and then cuts the fourth word of the eighth line.
   objEditPt.StartOfDocument()
   objEditPt.LineDown(3)
   objEditPt.WordRight(3)
   objEditPt.Copy(4)
   objEditPt.Paste()
   objEditPt.LineDown(3)
   objEditPt.WordRight(3)
   objEditPt.Cut(4)
End Sub

.NET Framework 安全性

請參閱

參考

EditPoint2 介面

Cut 多載

EnvDTE80 命名空間