Share via


AnnotationHelper.CreateHighlightForSelection Méthode

Définition

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

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'annotations à utiliser pour créer l'annotation en surbrillance.

author
String

Auteur de l'annotation.

highlightBrush
Brush

Pinceau à utiliser pour appliquer la surbrillance au contenu sélectionné.

Retours

Annotation

Annotation en surbrillance ; ou null, si aucun contenu n'est sélectionné pour une mise en surbrillance.

Exceptions

service a la valeur null.

service n'est pas activé.

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

Remarques

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

S’il n’y a pas de contenu sélectionné (la longueur de la sélection est nulle), 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 le cas null, 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 d’appeler CreateHighlightForSelection.

S’applique à

Voir aussi