EditPoint2.Copy 方法 (Object, Boolean)

将指定范围内的文本复制到剪贴板。

命名空间:  EnvDTE80
程序集:  EnvDTE80(在 EnvDTE80.dll 中)

语法

声明
Sub Copy ( _
    PointOrCount As Object, _
    Append As Boolean _
)
void Copy(
    Object PointOrCount,
    bool Append
)
void Copy(
    [InAttribute] Object^ PointOrCount, 
    [InAttribute] bool Append
)
abstract Copy : 
        PointOrCount:Object * 
        Append:bool -> unit 
function Copy(
    PointOrCount : Object, 
    Append : boolean
)

参数

  • Append
    类型:System.Boolean
    可选。指示是否将选定文本追加到剪贴板。默认值为 false。

备注

如果参数是 TextPoint 对象,则 Copy 复制表示编辑点和 PointOrCount 之间文本的字符串。 如果参数是整数,则 Copy 复制表示编辑点后指定数目的字符的字符串(每个隐含的换行序列在各行尾占一个字符)。 如果 PointOrCount 为负,则 Copy 复制编辑点之前(而不是之后)的文本。

如果 Append 是 true,则 Copy 将选定内容追加到当前剪贴板内容而不是替换剪贴板内容。

示例

Sub CopyExample()
   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 接口

Copy 重载

EnvDTE80 命名空间