AnnotationService Costruttori
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Inizializza una nuova istanza della classe AnnotationService da utilizzare con un controllo di visualizzazione del documento specificato.
Overload
AnnotationService(FlowDocumentReader) |
Inizializza una nuova istanza della classe AnnotationService da utilizzare con un controllo FlowDocumentReader specificato. |
AnnotationService(FlowDocumentScrollViewer) |
Inizializza una nuova istanza della classe AnnotationService da utilizzare con un controllo FlowDocumentScrollViewer specificato. |
AnnotationService(DocumentViewerBase) |
Inizializza una nuova istanza della classe AnnotationService da utilizzare con un controllo DocumentViewer o FlowDocumentPageViewer specificato. |
Esempio
Nell'esempio seguente viene illustrato l'uso del AnnotationService costruttore.
// ------------------------ 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
Commenti
Può AnnotationService essere usato con i controlli di visualizzazione dei documenti seguenti:
DocumentViewerBase sottoclassi derivate
AnnotationService(FlowDocumentReader)
Inizializza una nuova istanza della classe AnnotationService da utilizzare con un controllo FlowDocumentReader specificato.
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)
Parametri
- viewer
- FlowDocumentReader
Il controllo di lettura del documento associato a AnnotationService.
Esempio
Nell'esempio seguente viene illustrato l'uso del AnnotationService costruttore.
// ------------------------ 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
Vedi anche
Si applica a
AnnotationService(FlowDocumentScrollViewer)
Inizializza una nuova istanza della classe AnnotationService da utilizzare con un controllo FlowDocumentScrollViewer specificato.
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)
Parametri
- viewer
- FlowDocumentScrollViewer
Il controllo di visualizzazione del documento associato a AnnotationService.
Eccezioni
viewer
è null
.
Esempio
Nell'esempio seguente viene illustrato l'uso del AnnotationService costruttore.
// ------------------------ 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
Vedi anche
Si applica a
AnnotationService(DocumentViewerBase)
Inizializza una nuova istanza della classe AnnotationService da utilizzare con un controllo DocumentViewer o FlowDocumentPageViewer specificato.
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)
Parametri
- viewer
- DocumentViewerBase
Il controllo di visualizzazione del documento associato a AnnotationService.
Eccezioni
viewer
è null
.
Esempio
Nell'esempio seguente viene illustrato l'uso del AnnotationService costruttore.
// ------------------------ 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
Commenti
Questo costruttore può essere usato con DocumentViewerBase controlli derivati: