'We assume that the GdViewer1 control has been properly integrated.
Sub GdViewer1_MouseClick(ByVal sender As Object, ByVal e As MouseEventArgs)
Dim message As String = "This point is inside the document area."
Dim ViewerLeft As Integer = e.X, ViewerTop As Integer = e.Y
Dim DocumentLeft As Double = 0, DocumentTop As Double = 0
GdViewer1.CoordViewerPixelToDocumentInch(ViewerLeft, ViewerTop, DocumentLeft, DocumentTop)
Dim widthInches As Double = GdViewer1.PageWidth / GdViewer1.HorizontalResolution
Dim heightInches As Double = GdViewer1.PageHeight / GdViewer1.VerticalResolution
If DocumentLeft < 0 OrElse DocumentTop < 0 OrElse DocumentLeft >= widthInches OrElse DocumentTop >= heightInches Then
message = "This point is outside the document area."
End If
MessageBox.Show(message, "GdViewer.CoordViewerPixelToDocumentInch")
End Sub
//We assume that the GdViewer1 control has been properly integrated.
void GdViewer1_MouseClick(object sender, MouseEventArgs e)
{
string message = "This point is inside the document area.";
int ViewerLeft = e.X, ViewerTop = e.Y;
double DocumentLeft = 0, DocumentTop = 0;
GdViewer1.CoordViewerPixelToDocumentInch(ViewerLeft, ViewerTop, ref DocumentLeft, ref DocumentTop);
double widthInches = GdViewer1.PageWidth / GdViewer1.HorizontalResolution;
double heightInches = GdViewer1.PageHeight / GdViewer1.VerticalResolution;
if (DocumentLeft < 0 || DocumentTop < 0 || DocumentLeft >= widthInches || DocumentTop >= heightInches)
{
message = "This point is outside the document area.";
}
MessageBox.Show(message, "GdViewer.CoordViewerPixelToDocumentInch");
}