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。

备注

如果 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 命名空间