|
Dieser Artikel wurde maschinell übersetzt. Bewegen Sie den Mauszeiger über die Sätze im Artikel, um den Originaltext anzuzeigen. Weitere Informationen
|
Übersetzung
Original
|
Übersicht über Anmerkungen
Dieses Thema enthält folgende Abschnitte.
// ------------------------ 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()
<DocumentViewer.ContextMenu> <ContextMenu> <MenuItem Command="ApplicationCommands.Copy" /> <Separator /> <!-- Add a Highlight annotation to a user selection. --> <MenuItem Command="ann:AnnotationService.CreateHighlightCommand" Header="Add Highlight" /> <!-- Add a Text Note annotation to a user selection. --> <MenuItem Command="ann:AnnotationService.CreateTextStickyNoteCommand" Header="Add Text Note" /> <!-- Add an Ink Note annotation to a user selection. --> <MenuItem Command="ann:AnnotationService.CreateInkStickyNoteCommand" Header="Add Ink Note" /> <Separator /> <!-- Remove Highlights from a user selection. --> <MenuItem Command="ann:AnnotationService.ClearHighlightsCommand" Header="Remove Highlights" /> <!-- Remove Text Notes and Ink Notes from a user selection. --> <MenuItem Command="ann:AnnotationService.DeleteStickyNotesCommand" Header="Remove Notes" /> <!-- Remove Highlights, Text Notes, Ink Notes from a selection. --> <MenuItem Command="ann:AnnotationService.DeleteAnnotationsCommand" Header="Remove Highlights & Notes" /> </ContextMenu> </DocumentViewer.ContextMenu>
void annotationsListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { Annotation comment = (sender as ListBox).SelectedItem as Annotation; if (comment != null) { // IAnchorInfo info; // service is an AnnotationService object // comment is an Annotation object info = AnnotationHelper.GetAnchorInfo(this.service, comment); TextAnchor resolvedAnchor = info.ResolvedAnchor as TextAnchor; TextPointer textPointer = (TextPointer)resolvedAnchor.BoundingStart; textPointer.Paragraph.BringIntoView(); } }