EditPoint.Copy 方法

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

命名空间:  EnvDTE
程序集:  EnvDTE(在 EnvDTE.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
)

参数

  • PointOrCount
    类型:Object

    必需。 或者是 TextPoint 对象,或者是字符数。

  • Append
    类型: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 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 安全性

请参阅

参考

EditPoint 接口

EnvDTE 命名空间