GdPicture.NET Reference Guide
IsAnnotationVisibleAt Method (GdViewer)
Example 





GdPicture14.WPF Namespace > GdViewer Class : IsAnnotationVisibleAt 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.
The horizontal (X) coordinate of the required point, in pixels, related to the current GdViewer control space.
The vertical (Y) coordinate of the required point, in pixels, related to the current GdViewer control space.
Indicates, whether the specified point related to the current GdViewer control space, is contained within the bounding box of the annotation specified by its index. The coordinates of the required point, in pixels, relates to the current control space and the specified annotation relates to the currently displayed page of the document loaded in the GdViewer control.

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

Syntax
'Declaration
 
Public Function IsAnnotationVisibleAt( _
   ByVal AnnotationIdx As Integer, _
   ByVal X As Integer, _
   ByVal Y As Integer _
) As Boolean
public bool IsAnnotationVisibleAt( 
   int AnnotationIdx,
   int X,
   int Y
)
public function IsAnnotationVisibleAt( 
    AnnotationIdx: Integer;
    X: Integer;
    Y: Integer
): Boolean; 
public function IsAnnotationVisibleAt( 
   AnnotationIdx : int,
   X : int,
   Y : int
) : boolean;
public: bool IsAnnotationVisibleAt( 
   int AnnotationIdx,
   int X,
   int Y
) 
public:
bool IsAnnotationVisibleAt( 
   int AnnotationIdx,
   int X,
   int Y
) 

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.
X
The horizontal (X) coordinate of the required point, in pixels, related to the current GdViewer control space.
Y
The vertical (Y) coordinate of the required point, in pixels, related to the current GdViewer control space.

Return Value

True/true if the specified point is contained within the annotation bounding box, else False/false.
Remarks
We strongly recommend using the GetStat method to identify the specific reason for the method's failure.

Please note that this method expects to have the GdPicture XMP/Annotations Plugin to be unlocked. The method only handles GdPicture/XMP annotations as well.

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

Example
How to find out if the selected annotation is visible on the clicked point.
'We assume that the GdViewer1 control has been properly integrated.
Private Sub GdViewer1_MouseClick(ByVal sender As Object, ByVal e As MouseEventArgs) Handles GdViewer1.MouseClick
    Dim annotIdx As Integer = GdViewer1.GetSelectedAnnotationIdx()
    If annotIdx >= 0 Then
        Dim isVisible As Boolean = GdViewer1.IsAnnotationVisibleAt(annotIdx, CInt(e.GetPosition(Me).X), CInt(e.GetPosition(Me).Y)
        If GdViewer1.GetStat() = GdPictureStatus.OK Then
            If isVisible Then
                MessageBox.Show("The clicked point is within the annotation's bounding box.", "GdViewer.IsAnnotationVisibleAt")
            Else
                MessageBox.Show("The selected annotation is not visible on that point.", "GdViewer.IsAnnotationVisibleAt")
            End If
        End If
    Else
        MessageBox.Show("No annotation is currently selected.", "GdViewer.IsAnnotationVisibleAt")
    End If
End Sub
//We assume that the GdViewer1 control has been properly integrated.
void GdViewer1_MouseClick(object sender, MouseEventArgs e)
{
    int annotIdx = GdViewer1.GetSelectedAnnotationIdx();
    if (annotIdx >= 0)
    {
        bool isVisible = GdViewer1.IsAnnotationVisibleAt(annotIdx, (int)e.GetPosition(this).X, (int)e.GetPosition(this).Y);
        if (GdViewer1.GetStat() == GdPictureStatus.OK)
        {
            if (isVisible)
            {
                MessageBox.Show("The clicked point is within the annotation's bounding box.", "GdViewer.IsAnnotationVisibleAt");
            }
            else
            {
                MessageBox.Show("The selected annotation is not visible on that point.", "GdViewer.IsAnnotationVisibleAt");
            }
        }
    }
    else
    {
        MessageBox.Show("No annotation is currently selected.", "GdViewer.IsAnnotationVisibleAt");
    }
}
See Also

Reference

GdViewer Class
GdViewer Members
GetAnnotationCount Method
GetAnnotationFromIdx Method
SelectAnnotation Method
GetSelectedAnnotationIdx Method
GetAnnotationManager Method