次の方法で共有


AnnotationService コンストラクター

定義

指定したドキュメント表示コントロールで使用する AnnotationService クラスの新しいインスタンスを初期化します。

オーバーロード

AnnotationService(FlowDocumentReader)

指定した AnnotationService コントロールで使用する FlowDocumentReader クラスの新しいインスタンスを初期化します。

AnnotationService(FlowDocumentScrollViewer)

指定した AnnotationService コントロールで使用する FlowDocumentScrollViewer クラスの新しいインスタンスを初期化します。

AnnotationService(DocumentViewerBase)

指定した AnnotationService コントロールまたは DocumentViewer コントロールで使用する FlowDocumentPageViewer クラスの新しいインスタンスを初期化します。

次の例は、 コンストラクターの使用を 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 == true)
        _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 、次のドキュメント表示コントロールで使用できます。

AnnotationService(FlowDocumentReader)

指定した AnnotationService コントロールで使用する FlowDocumentReader クラスの新しいインスタンスを初期化します。

public:
 AnnotationService(System::Windows::Controls::FlowDocumentReader ^ viewer);
public AnnotationService (System.Windows.Controls.FlowDocumentReader viewer);
new System.Windows.Annotations.AnnotationService : System.Windows.Controls.FlowDocumentReader -> System.Windows.Annotations.AnnotationService
Public Sub New (viewer As FlowDocumentReader)

パラメーター

viewer
FlowDocumentReader

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 == true)
        _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(FlowDocumentScrollViewer)

指定した AnnotationService コントロールで使用する FlowDocumentScrollViewer クラスの新しいインスタンスを初期化します。

public:
 AnnotationService(System::Windows::Controls::FlowDocumentScrollViewer ^ viewer);
public AnnotationService (System.Windows.Controls.FlowDocumentScrollViewer viewer);
new System.Windows.Annotations.AnnotationService : System.Windows.Controls.FlowDocumentScrollViewer -> System.Windows.Annotations.AnnotationService
Public Sub New (viewer As FlowDocumentScrollViewer)

パラメーター

viewer
FlowDocumentScrollViewer

AnnotationService に関連付けられたドキュメント表示コントロール。

例外

viewernullです。

次の例は、 コンストラクターの使用を 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 == true)
        _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 コントロールまたは DocumentViewer コントロールで使用する FlowDocumentPageViewer クラスの新しいインスタンスを初期化します。

public:
 AnnotationService(System::Windows::Controls::Primitives::DocumentViewerBase ^ viewer);
public AnnotationService (System.Windows.Controls.Primitives.DocumentViewerBase viewer);
new System.Windows.Annotations.AnnotationService : System.Windows.Controls.Primitives.DocumentViewerBase -> System.Windows.Annotations.AnnotationService
Public Sub New (viewer As DocumentViewerBase)

パラメーター

viewer
DocumentViewerBase

AnnotationService に関連付けられたドキュメント表示コントロール。

例外

viewernullです。

次の例は、 コンストラクターの使用を 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 == true)
        _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

注釈

このコンストラクターは、派生コントロールで DocumentViewerBase 使用できます。

こちらもご覧ください

適用対象