Example





In This Topic
GdPicture14 Namespace / GdViewer Class / GetRectHeightOnViewer Method

GetRectHeightOnViewer Method (GdViewer)

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

Return Value

The height, in pixels, of the rectangle of area selection, related to the viewer area.
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 viewer area.

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.GetRectHeightOnViewer")
//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.GetRectHeightOnViewer");
See Also