AnnotationService 类

定义

提供Microsoft批注框架的核心服务,用于管理和显示用户批注。

public ref class AnnotationService sealed : System::Windows::Threading::DispatcherObject
public sealed class AnnotationService : System.Windows.Threading.DispatcherObject
type AnnotationService = class
    inherit DispatcherObject
Public NotInheritable Class AnnotationService
Inherits DispatcherObject
继承
AnnotationService

示例

以下示例演示如何创建和启动 。AnnotationService

// ------------------------ StartAnnotations --------------------------
/// <summary>
///   Enables annotations and displays all that are viewable.</summary>
private void StartAnnotations()
{
    // If there is no AnnotationService yet, create one.
    if (_annotService == null)
        // docViewer is a document viewing control named in Window1.xaml.
        _annotService = new AnnotationService(docViewer);

    // If the AnnotationService is currently enabled, disable it.
    if (_annotService.IsEnabled)
        _annotService.Disable();

    // Open a stream to the file for storing annotations.
    _annotStream = new FileStream(
        _annotStorePath, FileMode.OpenOrCreate, FileAccess.ReadWrite);

    // Create an AnnotationStore using the file stream.
    _annotStore = new XmlStreamStore(_annotStream);

    // Enable the AnnotationService using the new store.
    _annotService.Enable(_annotStore);
}// end:StartAnnotations()
' ------------------------ StartAnnotations --------------------------
''' <summary>
'''   Enables annotations and displays all that are viewable.</summary>
Private Sub StartAnnotations()
    ' If there is no AnnotationService yet, create one.
    If _annotService Is Nothing Then
        ' docViewer is a document viewing control named in Window1.xaml.
        _annotService = New AnnotationService(docViewer)
    End If

    ' If the AnnotationService is currently enabled, disable it.
    If _annotService.IsEnabled = True Then
        _annotService.Disable()
    End If

    ' Open a stream to the file for storing annotations.
    _annotStream = New FileStream(_annotStorePath, FileMode.OpenOrCreate, FileAccess.ReadWrite)

    ' Create an AnnotationStore using the file stream.
    _annotStore = New XmlStreamStore(_annotStream)

    ' Enable the AnnotationService using the new store.
    _annotService.Enable(_annotStore)
End Sub

构造函数

名称 说明
AnnotationService(DocumentViewerBase)

初始化类的新实例 AnnotationService ,以便与指定 DocumentViewerFlowDocumentPageViewer 控件一起使用。

AnnotationService(FlowDocumentReader)

初始化类的新实例 AnnotationService ,以便与指定的 FlowDocumentReader 控件一起使用。

AnnotationService(FlowDocumentScrollViewer)

初始化类的新实例 AnnotationService ,以便与指定的 FlowDocumentScrollViewer 控件一起使用。

字段

名称 说明
ClearHighlightsCommand

表示用于清除当前所选内容的注释的命令。

CreateHighlightCommand

表示用于在当前选定内容上创建突出显示批注的命令。

CreateInkStickyNoteCommand

表示用于在当前选定内容上创建墨迹注释注释的命令。

CreateTextStickyNoteCommand

表示用于在当前选定内容上创建文本注释的命令。

DeleteAnnotationsCommand

表示用于删除当前选定内容中的所有墨迹注释、文本注释和突出显示批注的命令。

DeleteStickyNotesCommand

表示用于删除当前选定内容中的所有墨迹注释和文本注释的命令。

属性

名称 说明
Dispatcher

获取与此DispatcherDispatcherObject关联的值。

(继承自 DispatcherObject)
IsEnabled

获取一个值,该值指示是否 AnnotationService 启用。

Store

AnnotationStore获取由此AnnotationService使用的 。

方法

名称 说明
CheckAccess()

确定调用线程是否有权访问此 DispatcherObject权限。

(继承自 DispatcherObject)
Disable()

禁用批注处理并隐藏所有可见批注。

Enable(AnnotationStore)

AnnotationService启用与给定AnnotationStore的一起使用并显示所有可见批注。

Equals(Object)

确定指定的对象是否等于当前对象。

(继承自 Object)
GetHashCode()

用作默认哈希函数。

(继承自 Object)
GetService(DocumentViewerBase)

返回 AnnotationService 与指定文档查看控件关联的实例。

GetService(FlowDocumentReader)

返回与 AnnotationService 指定 FlowDocumentReader项关联的值。

GetService(FlowDocumentScrollViewer)

返回与 AnnotationService 指定 FlowDocumentScrollViewer项关联的值。

GetType()

获取当前实例的 Type

(继承自 Object)
MemberwiseClone()

创建当前 Object的浅表副本。

(继承自 Object)
ToString()

返回一个表示当前对象的字符串。

(继承自 Object)
VerifyAccess()

强制调用线程有权访问此 DispatcherObject权限。

(继承自 DispatcherObject)

适用于