IAnchorInfo Interface

Definição

Fornece as capacidades para emparelhar anotações com os objetos anotados correspondentes.

public interface class IAnchorInfo
public interface IAnchorInfo
type IAnchorInfo = interface
Public Interface IAnchorInfo

Exemplos

Considere uma aplicação simples de leitor de documentos que tem um painel de comentários. O painel de comentários pode ser uma caixa de listagem que exibe o texto de uma lista de anotações ancoradas em um documento. Se o usuário selecionar um item na caixa de listagem, o aplicativo exibirá o parágrafo no documento ao qual o objeto de anotação correspondente está ancorado.

O exemplo seguinte demonstra como implementar o gestor de eventos de uma caixa de lista que serve como painel de comentários:

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

Propriedades

Name Description
Anchor

Fica com a âncora da anotação.

Annotation

Recebe o objeto de anotação.

ResolvedAnchor

Obtém o objeto que representa a localização na árvore onde o Anchor é resolvido.

Aplica-se a

Ver também