Udostępnij za pośrednictwem


EditPoint.Cut Method

Copies the specified range of text to the clipboard and deletes it from the document.

Namespace:  EnvDTE
Assembly:  EnvDTE (in EnvDTE.dll)

Syntax

'Declaration
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
)

Parameters

  • Append
    Type: System.Boolean
    Optional. Indicates whether to append the selected text to the clipboard. The default is false.

Remarks

If PointOrCount is a TextPoint object, Cut cuts the text between the edit point and PointOrCount and places it on the clipboard. If PointOrCount is an integer, then Cut cuts the text after the edit point for the specified number of characters following the edit point (adding one for each implied newline sequence at the end of each line). If PointOrCount is negative, then Cut cuts text before the edit point.

If Append is true, then Cut appends the selection to the current clipboard contents rather than replacing it.

Examples

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 and pastes it, 
   ' 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 Security

See Also

Reference

EditPoint Interface

EnvDTE Namespace