Example





In This Topic
GdPicture14 Namespace / GdViewer Class / GetRectHeightOnDocument Method

GetRectHeightOnDocument Method (GdViewer)

In This Topic
Returns the height, in pixels, of the rectangle of area selection, related to the current page. The resulting value corresponds to the actual document pages area of the document displayed in the GdViewer control. You can determine, if the rectangle of selection is currently defined and drawn within the control, using the IsRect method.
Syntax
'Declaration
 
Public Function GetRectHeightOnDocument() As Integer
public int GetRectHeightOnDocument()
public function GetRectHeightOnDocument(): Integer; 
public function GetRectHeightOnDocument() : int;
public: int GetRectHeightOnDocument(); 
public:
int GetRectHeightOnDocument(); 

Return Value

The height, in pixels, of the rectangle of area selection, related to the current page.
Remarks
Be aware that you are allowed to define only one rectangle of selection within the GdViewer control. Likewise, this rectangle always relates to the currently displayed document, meaning that without displaying some document you cannot get valid rectangle's data.

Just to remind you, that this value is related to the current page determined by the CurrentPage property.

Example
How to compare the height of the rectangle of selection related to the document pages area with the height related to the viewer area.
'We assume that the GdViewer1 control has been properly integrated
'and your document has been properly displayed as well.
GdViewer1.RectBorderColor = GdViewer1.ARGB(255, 69, 0)
GdViewer1.RectBorderSize = 2
'You can change the zoom mode here.
GdViewer1.ZoomMode = GdPicture14.ViewerZoomMode.ZoomModeToViewer
'Setting the rectangle of selection.
Dim left As Integer = 0, top As Integer = 0, width As Integer = 0, height As Integer = 0
GdViewer1.GetDisplayedArea(left, top, width, height)
GdViewer1.SetRectCoordinatesOnDocument(left, top, width, height)
'Finding coordinates to compare.
Dim heightViewer As Integer = GdViewer1.GetRectHeightOnDocument()
Dim heightDoc As Integer = GdViewer1.GetRectHeightOnViewer()
MessageBox.Show("The height on the viewer is " + widthViewer + " pixels." + vbCrLf +
                "The height on the document's page is " + widthDoc + " pixels.", "GdViewer.GetRectHeightOnDocument")
//We assume that the GdViewer1 control has been properly integrated
//and your document has been properly displayed as well.
GdViewer1.RectBorderColor = GdViewer1.ARGB(255, 69, 0);
GdViewer1.RectBorderSize = 2;
//You can change the zoom mode here.
GdViewer1.ZoomMode = GdPicture14.ViewerZoomMode.ZoomModeToViewer;
//Setting the rectangle of selection.
int left = 0, top = 0, width = 0, height = 0;
GdViewer1.GetDisplayedArea(ref left, ref top, ref width, ref height);
GdViewer1.SetRectCoordinatesOnDocument(left, top, width, height);
//Finding coordinates to compare.
int heightViewer = GdViewer1.GetRectHeightOnDocument();
int heightDoc = GdViewer1.GetRectHeightOnViewer();
MessageBox.Show("The height on the viewer is " + widthViewer + " pixels.\nThe height on the document's page is " + widthDoc + " pixels.", "GdViewer.GetRectHeightOnDocument");
See Also