Langue

IAnchorInfo.ResolvedAnchor Propriété

Définition

Obtient l’objet qui représente l’emplacement dans l’arborescence où le Anchor fichier est résolu.

public:
 property System::Object ^ ResolvedAnchor { System::Object ^ get(); };
public object ResolvedAnchor { get; }
member this.ResolvedAnchor : obj
Public ReadOnly Property ResolvedAnchor As Object

Valeur de propriété

Objet qui représente l’emplacement dans l’arborescence dans laquelle le Anchor fichier est résolu. Le type est spécifié par le type de l’objet annoté. Les notes collantes et les surbrillances dans le flux ou les documents fixes sont toujours résolus en objet TextAnchor .

Exemples

Considérez une application de lecteur de document simple qui a un volet commentaires. Le volet commentaires peut être une zone de liste qui affiche le texte d’une liste d’annotations ancrées dans un document. Si l’utilisateur sélectionne un élément dans la zone de liste, l’application affiche le paragraphe du document auquel l’objet d’annotation correspondant est ancré.

L’exemple suivant montre comment implémenter le gestionnaire d’événements d’une telle zone de liste qui sert de volet commentaires :

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();
    }
}
Private Sub annotationsListBox_SelectionChanged(ByVal sender As Object, ByVal e As SelectionChangedEventArgs)

    Dim comment As Annotation = TryCast((TryCast(sender, ListBox)).SelectedItem, Annotation)
    If comment IsNot Nothing Then
        ' service is an AnnotationService object
        ' comment is an Annotation object
        info = AnnotationHelper.GetAnchorInfo(Me.service, comment)
        Dim resolvedAnchor As TextAnchor = TryCast(info.ResolvedAnchor, TextAnchor)
        Dim textPointer As TextPointer = CType(resolvedAnchor.BoundingStart, TextPointer)
        textPointer.Paragraph.BringIntoView()
    End If
End Sub

S’applique à