Example





In This Topic
GdPicture14 Namespace / GdViewer Class / GetDocumentLeft Method

GetDocumentLeft Method (GdViewer)

In This Topic
Returns the horizontal (X) coordinate of the point on the current page located in the document pages area, in pixels, that matches to the point on the current page of the displayed document located exactly in the top left corner within the GdViewer control. Be aware that the resulting coordinate may be negative if the current page is shifted in the control.
Syntax
'Declaration
 
Public Function GetDocumentLeft() As Integer
public int GetDocumentLeft()
public function GetDocumentLeft(): Integer; 
public function GetDocumentLeft() : int;
public: int GetDocumentLeft(); 
public:
int GetDocumentLeft(); 

Return Value

The horizontal coordinate of the point on the document pages area, in pixels, that corresponds to the document's point located in the top left corner of the control.
Remarks
You can regularly apply the GetStat method to determine if this method has been successful.

Just to remind you, that this coordinate is 0-based with the origin being in the top left corner of the control and it is related to the current page determined by the CurrentPage property.

Example
How to determine the point in the document area that matches to the point located in the top left corner of the viewer area.
'We assume that the GdViewer1 control has been properly integrated
'and your document has been properly displayed as well.
Dim left As Integer = 0, top As Integer = 0, width As Integer = 0, height As Integer = 0
GdViewer1.GetDisplayedArea(left, top, width, height)
Dim leftDoc As Integer = GdViewer1.GetDocumentLeft()
Dim topDoc As Integer = GdViewer1.GetDocumentTop()
MessageBox.Show("Page width (X): " + GdViewer1.PageWidth + vbCrLf + "Page height (Y): " + GdViewer1.PageHeight + vbCrLf + vbCrLf +
                "Document: top-left point (X,Y): " + leftDoc + ", " + topDoc + vbCrLf +
                "Displayed area:" + vbCrLf + "  top-left point (X,Y): " + left + ", " + top + vbCrLf + "  width: " + width + "  height: " + height, "GdViewer.GetDocumentLeft")
//We assume that the GdViewer1 control has been properly integrated
//and your document has been properly displayed as well.
int left = 0, top = 0, width = 0, height = 0;
GdViewer1.GetDisplayedArea(ref left, ref top, ref width, ref height);
int leftDoc = GdViewer1.GetDocumentLeft();
int topDoc = GdViewer1.GetDocumentTop();
MessageBox.Show("Page width (X): " + GdViewer1.PageWidth + "\nPage height (Y): " + GdViewer1.PageHeight + "\n\n" +
                "Document: top-left point (X,Y): " + leftDoc + ", " + topDoc + "\n" +
                "Displayed area:\n  top-left point (X,Y): " + left + ", " + top + "\n  width: " + width + "  height: " + height, "GdViewer.GetDocumentLeft");
See Also