Table of Contents

17.18 ImageView

The ImageView (gb.form) component implements an image viewer.

B1

Figure 17.18.1: Image display in an ImageView.

B2

Figure 17.18.1: Image section with grid shown ( zoom factor = 10 )

17.18.1 Properties

The following table describes selected properties of an ImageView:

PropertyTypeDescription
ImageImageSets the image displayed in the ImageView or returns this image.
GridBooleanFor the value True, a grid is displayed or returned for an integer zoom level greater than 2.
UseMouseBooleanFor the value True the ImageView reacts to mouse events or returns the value.
ZoomFloatSets the zoom factor or returns the zoom factor. For example, the value 2 corresponds to twice the display size of the original image.

Table 17.18.1.1: Properties of the ImageView component

17.18.2 Methods

MethodDescription
EnsureVisible ( X As Integer, Y As Integer, W As Integer, H As Integer )Ensures that a specified area of the display area is visible.
ImageToView ( ImagePoint As Point ) As PointConverts an image point from image coordinates to ImageView coordinates.
ViewToImage ( ViewPoint As Point ) As PointConverts a point from ImageView coordinates to image coordinates.
Update ( [ Image As Image ] )Replaces the displayed image in the ImageView with an image passed as an optional argument. The zoom factor is not reset during the update.
ZoomFit ( )Adjusts the image to the size of the ImageView by setting the zoom level internally.

Table 17.18.2.1: Overview of selected methods of the class ImageView

17.18.3 Project 1

In project 1, you are presented with a simple image viewer → Figure 17.18.1. An image in grey tones is displayed as the start image. Via a dialogue (MultiSelect) you can select one picture or several pictures (picture list) in a directory.

17.18.4 Project 2

In the second project you can learn about the close relationship between the two components ImageView and ScrollArea:

B3

Figure 17.18.4.1: ScrollArea and ImageView

Download