AnnotationHelper.CreateHighlightForSelection Méthode

Définition

Crée une annotation en surbrillance sur la sélection actuelle du contrôle visionneuse associé au contrôle spécifié AnnotationService.

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

Paramètres

service
AnnotationService

Service d’annotation à utiliser pour créer l’annotation en surbrillance.

author
String

Auteur de l’annotation.

highlightBrush
Brush

Pinceau à utiliser pour dessiner la surbrillance sur le contenu sélectionné.

Retours

Annotation en surbrillance ; ou null, s’il n’existe aucun contenu sélectionné à mettre en surbrillance.

Exceptions

service a la valeur null.

service n’est pas activé.

-ou-

highlightBrush dans pas un SolidColorBrush.

Le contrôle visionneuse ne contient aucune sélection de contenu.

Remarques

L’annotation en surbrillance est ancrée dans le contenu défini par la sélection actuelle du DocumentViewerBaseconstructeur, le FlowDocumentPageViewer, DocumentViewerle FlowDocumentScrollViewer, ou FlowDocumentReader le AnnotationService contrôle spécifié au constructeur.

S’il n’existe aucun contenu sélectionné (la longueur de sélection est égale à zéro), aucune annotation n’est créée et une InvalidOperationException exception est levée.

author peut être spécifié comme null dans le cas où aucun auteur n’est défini.

Si highlightBrush c’est nullle cas, le pinceau de surbrillance par défaut de l’annotation service donnée est utilisé.

L’annotation service donnée doit être activée au moyen d’un appel avant AnnotationService.Enable l’appel CreateHighlightForSelection.

S’applique à

Voir aussi