PictureBox

The PictureBox control allows you to display an image in one of several (BMP, GIF, ICO, JPEG, PNG) image file formats. The control also allows you to configure the display of the image within the box - with options such as Zoom and Centre.

Properties

Key properties of the PictureBox control include:

  • Image. The file location or URL of the image to be displayed in the box.
  • SizeMode. Determines the display method for the image in the picture box. The available methods include Zoom, StretchImage and AutoSize, among others.

Events

Key events for the PictureBox control include:

  • Click. Determines what occurs when a user clicks the image displayed.

  • Resize. Determines what happens to the PictureBox when the form is resized.

For information on configuring events and other components of the design using a script, see: Working with Scripts.

Adding a PictureBox

When you drag a PictureBox control to a form, use the control properties to select the Choose Image... option.

This will open an Explorer window from which you can navigate to and select the image to be displayed in the picture box.

Use the control properties to select the required Size Mode for the image display.

The available size modes are as follows:

  • Normal - No scaling or special placement is processed for the selected image. The image is clipped if it is larger than the box. To make the whole image visible, the PictureBox will have to be resized.

  • StretchImage - The selected image will be displayed in whole, stretched or shrunk, without any concession to the aspect ratio. This can mean that the image is distorted if the box is not appropriately sized.

  • AutoSize - The PictureBox will be automatically resized to display the entirety of the selected image. The Form will not be resized, so the image will not be displayed if it is too large.

  • CenterImage - The selected image is displayed at the original size in the centre of the PictureBox. If the selected image is larger than the control size, the picture is centred in the box and parts of the image that are outside the box are clipped.

  • Zoom - The selected picture is resized, up or down, to fit to the size of the PictureBox. The aspect ratio of the original image is maintained.

Other properties and events for the PictureBox control can be configured using the Properties panel.

Information on the properties and events for the PictureBox control can be viewed at the link to Microsoft® Documentation.