GdPicture.NET.14
GdPicture14 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.
Example





In This Topic
IsAnnotationVisibleAt Method (GdViewer)
In This Topic
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 if the specified point is contained within the annotation bounding box, else false.
Remarks
It is recommend to use the GetStat method to identify the specific reason for the method's failure, if any.

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, e.X, e.Y)
        If GdViewer1.GetStat() = GdPictureStatus.OK Then
            If isVisible Then
                MessageBox.Show("The clicked point is within the annotation 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, e.X, e.Y);
        if (GdViewer1.GetStat() == GdPictureStatus.OK)
        {
            if (isVisible)
            {
                MessageBox.Show("The clicked point is within the annotation 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