共用方式為


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
)

參數

  • 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 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 命名空間