EditPoint2.Copy(Object, Boolean) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
将指定范围内的文本复制到剪贴板。
void Copy(winrt::Windows::Foundation::IInspectable const & PointOrCount, bool Append = false);
[System.Runtime.InteropServices.DispId(136)]
public void Copy (object PointOrCount, bool Append = false);
[<System.Runtime.InteropServices.DispId(136)>]
abstract member Copy : obj * bool -> unit
Public Sub Copy (PointOrCount As Object, Optional Append As Boolean = false)
参数
- Append
- Boolean
可选。 指示是否将选定文本追加到剪贴板。 默认为 false。
实现
- 属性
示例
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
注解
如果参数是一个 TextPoint 对象,则 Copy 复制一个字符串,该字符串表示编辑点与之间的文本 PointOrCount 。 如果参数是一个整数,则会 Copy 复制一个字符串,该字符串表示编辑点后的指定数量的字符 (在每行) 结束时,为每个隐含的换行序列计算一次。 如果 PointOrCount 为负,则在 Copy 编辑点之前复制文本,而不是在之后复制文本。
如果 Append 为 true ,则将 Copy 所选内容追加到当前剪贴板内容而不是替换。