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。

實作

EditPoint.Copy(Object, Boolean)

備註

如果引數是 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 命名空間