'We assume that the GdViewer1 control has been properly integrated
'and your document has been properly displayed as well.
Dim left1 As Double = 0, top1 As Double = 0, width1 As Double = 0, height1 As Double = 0
Dim left2 As Double = 0, top2 As Double = 0, width2 As Double = 0, height2 As Double = 0
GdViewer1.RectBorderColor = Color.FromArgb(255, 255, 69, 0)
GdViewer1.RectBorderSize = 2
GdViewer1.GetDisplayedArea(left1, top1, width1, height1)
GdViewer1.SetRectCoordinatesOnDocumentPixel(left1, top1, width1, height1)
GdViewer1.GetRectCoordinatesOnViewerPixel(left2, top2, width2, height2)
MessageBox.Show("The displayed area of the document: " + left1 + ", " + top1 + " w=" + width1 + ", h=" + height1 + vbCrLf +
"The rectangle of selection (viewer-related): " + left2 + ", " + top2 + " w=" + width2 + ", h=" + height2, "GdViewer.GetRectCoordinatesOnViewerPixel")
//We assume that the GdViewer1 control has been properly integrated
//and your document has been properly displayed as well.
double left1 = 0, top1 = 0, width1 = 0, height1 = 0;
double left2 = 0, top2 = 0, width2 = 0, height2 = 0;
GdViewer1.RectBorderColor = Color.FromArgb(255, 255, 69, 0);
GdViewer1.RectBorderSize = 2;
GdViewer1.GetDisplayedArea(ref left1, ref top1, ref width1, ref height1);
GdViewer1.SetRectCoordinatesOnDocumentPixel(left1, top1, width1, height1);
GdViewer1.GetRectCoordinatesOnViewerPixel(ref left2, ref top2, ref width2, ref height2);
MessageBox.Show("The displayed area of the document: " + left1 + ", " + top1 + " w=" + width1 + ", h=" + height1 +
"\nThe rectangle of selection (viewer-related): " + left2 + ", " + top2 + " w=" + width2 + ", h=" + height2, "GdViewer.GetRectCoordinatesOnViewerPixel");