语言

AnnotationHelper.CreateInkStickyNoteForSelection 方法

定义

针对与指定 AnnotationService控件关联的查看器控件的当前选择创建墨迹便笺批注。

public:
 static System::Windows::Annotations::Annotation ^ CreateInkStickyNoteForSelection(System::Windows::Annotations::AnnotationService ^ service, System::String ^ author);
public static System.Windows.Annotations.Annotation CreateInkStickyNoteForSelection(System.Windows.Annotations.AnnotationService service, string author);
static member CreateInkStickyNoteForSelection : System.Windows.Annotations.AnnotationService * string -> System.Windows.Annotations.Annotation
Public Shared Function CreateInkStickyNoteForSelection (service As AnnotationService, author As String) As Annotation

参数

service
AnnotationService

用于创建墨迹便笺批注的批注服务。

author
String

批注的作者。

返回

墨迹便笺批注;或者 null,如果没有要批注的选定内容。

例外

service 是 null。

service 未启用。

查看器控件不包含内容选择。

注解

墨迹便笺批注将定位到当前选择DocumentViewerBase的构造函数指定的 DocumentViewer 、FlowDocumentPageViewer、FlowDocumentScrollViewerFlowDocumentReader或AnnotationService控件所定义的内容。

如果没有用户选择的内容(选择长度为零长度),则不会创建批注并引发批 InvalidOperationException 注。

author 可以指定为 null 未定义作者的情况。

必须通过调用之前service调用AnnotationService.Enable来启用给定批注CreateInkStickyNoteForSelection。

适用于

另请参阅