Reference Guide
GdPicture14.WPF Namespace / GdViewer Class / GetAnnotationFromIdx Method
The 0-based index of the required annotation within the current page of the displayed document. It must be a value from 0 to GetAnnotationCount-1.
Example





In This Topic
    GetAnnotationFromIdx Method (GdViewer)
    In This Topic
    Returns a required GdPicture/XMP annotation object specified by its index related to the current page of the document displayed in the GdViewer control.

    Be aware that this method only handles GdPicture/XMP annotations.

    Syntax
    'Declaration
     
    
    Public Function GetAnnotationFromIdx( _
       ByVal AnnotationIdx As Integer _
    ) As Annotation
    public Annotation GetAnnotationFromIdx( 
       int AnnotationIdx
    )
    public function GetAnnotationFromIdx( 
        AnnotationIdx: Integer
    ): Annotation; 
    public function GetAnnotationFromIdx( 
       AnnotationIdx : int
    ) : Annotation;
    public: Annotation* GetAnnotationFromIdx( 
       int AnnotationIdx
    ) 
    public:
    Annotation^ GetAnnotationFromIdx( 
       int AnnotationIdx
    ) 

    Parameters

    AnnotationIdx
    The 0-based index of the required annotation within the current page of the displayed document. It must be a value from 0 to GetAnnotationCount-1.

    Return Value

    The required GdPicture/XMP annotation object of the type GdPicture14.Annotations.Annotation. Please always use the GetStat method to determine if this method has been successful.
    Remarks
    We strongly recommend using the GetStat method to identify the specific reason for the method's failure.

    Be aware that annotations are always treated relative to the currently displayed page.

    Example
    How to get the required annotation object specified by its index within the current page.
    'We assume that the GdViewer1 control has been properly integrated
    'and your document has been properly displayed as well.
    Dim annotCount As Integer = GdViewer1.GetAnnotationCount()
    Dim message As String = "The number of GdPicture/XMP annotations on the current page: " + annotCount
    Dim annot As GdPicture14.Annotations.Annotation = Nothing
    For i As Integer = 0 To annotCount - 1
        annot = GdViewer1.GetAnnotationFromIdx(i)
        If GdViewer1.GetStat() = GdPictureStatus.OK Then
            message = message + vbCrLf + i + "." + annot.Tag + " -  Author: " + annot.Author + "  Created: " + annot.CreationTime.ToString() + "  Subject: " + annot.Subject
        Else
            message = message + vbCrLf + i + ". - " + GdViewer1.GetStat().ToString()
        End If
    Next
    MessageBox.Show(message, "GdViewer.GetAnnotationFromIdx")
    //We assume that the GdViewer1 control has been properly integrated
    //and your document has been properly displayed as well.
    int annotCount = GdViewer1.GetAnnotationCount();
    string message = "The number of GdPicture/XMP annotations on the current page: " + annotCount;
    GdPicture14.Annotations.Annotation annot = null;
    for (int i = 0; i < annotCount; i++)
    {
        annot = GdViewer1.GetAnnotationFromIdx(i);
        if (GdViewer1.GetStat() == GdPictureStatus.OK)
            message = message + "\n" + i + "." + annot.Tag + " -  Author: " + annot.Author + "  Created: " + annot.CreationTime + "  Subject: " + annot.Subject;
        else
            message = message + "\n" + i + ". - " + GdViewer1.GetStat().ToString();
    }
    MessageBox.Show(message, "GdViewer.GetAnnotationFromIdx");
    See Also