The horizontal (X) coordinate, in pixels, of the point located inside the viewer area.
The vertical (Y) coordinate, in pixels, of the point located inside the viewer area.
Output parameter. The horizontal (X) coordinate, in pixels, of the corresponding point located inside the document area.
Output parameter. The vertical (Y) coordinate, in pixels, of the corresponding point located inside the document area.
Example





In This Topic
GdPicture14 Namespace / GdViewer Class / CoordViewerToDocument Method

CoordViewerToDocument Method (GdViewer)

In This Topic
Translates the coordinates of the point located in the GdViewer control area (the viewer space), in pixels, to the coordinates of the corresponding point located in the displayed document (the document space), in pixels. That said, the point with the coordinates (ViewerLeft, ViewerTop) inside the current page displayed in the viewer area matches to the point with coordinates (DocumentLeft, DocumentTop) inside the page with the same page number in the displayed document.
Syntax
'Declaration
 
Public Sub CoordViewerToDocument( _
   ByVal ViewerLeft As Integer, _
   ByVal ViewerTop As Integer, _
   ByRef DocumentLeft As Integer, _
   ByRef DocumentTop As Integer _
) 
public void CoordViewerToDocument( 
   int ViewerLeft,
   int ViewerTop,
   ref int DocumentLeft,
   ref int DocumentTop
)
public procedure CoordViewerToDocument( 
    ViewerLeft: Integer;
    ViewerTop: Integer;
   var  DocumentLeft: Integer;
   var  DocumentTop: Integer
); 
public function CoordViewerToDocument( 
   ViewerLeft : int,
   ViewerTop : int,
   DocumentLeft : int,
   DocumentTop : int
);
public: void CoordViewerToDocument( 
   int ViewerLeft,
   int ViewerTop,
   ref int DocumentLeft,
   ref int DocumentTop
) 
public:
void CoordViewerToDocument( 
   int ViewerLeft,
   int ViewerTop,
   int% DocumentLeft,
   int% DocumentTop
) 

Parameters

ViewerLeft
The horizontal (X) coordinate, in pixels, of the point located inside the viewer area.
ViewerTop
The vertical (Y) coordinate, in pixels, of the point located inside the viewer area.
DocumentLeft
Output parameter. The horizontal (X) coordinate, in pixels, of the corresponding point located inside the document area.
DocumentTop
Output parameter. The vertical (Y) coordinate, in pixels, of the corresponding point located inside the document area.
Remarks
Just to inform you, that all coordinates are 0-based with the origin being in the top left corner and they are related to the current page determined by the CurrentPage property.
Example
How to determine the area of the point clicked by the mouse.
'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 Integer = 0, DocumentTop As Integer = 0
    GdViewer1.CoordViewerToDocument(ViewerLeft, ViewerTop, DocumentLeft, DocumentTop)
    If DocumentLeft < 0 OrElse DocumentTop < 0 OrElse DocumentLeft >= GdViewer1.PageWidth OrElse DocumentTop >= GdViewer1.PageHeight Then
        message = "This point is outside the document area."
    End If
    MessageBox.Show(message, "GdViewer.CoordViewerToDocument")
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;
    int DocumentLeft = 0, DocumentTop = 0;
    GdViewer1.CoordViewerToDocument(ViewerLeft, ViewerTop, ref DocumentLeft, ref DocumentTop);
    if (DocumentLeft < 0 || DocumentTop < 0 || DocumentLeft >= GdViewer1.PageWidth || DocumentTop >= GdViewer1.PageHeight)
    {
        message = "This point is outside the document area.";
    }
    MessageBox.Show(message, "GdViewer.CoordViewerToDocument");
}
See Also