Skip to content

TWebImageControl

Description

Below is a list of the most important properties methods and events for TWebImageControl. TWebImageControl can display an image on the form. TWebImageControl is similar to a VCL TImage.

Designtime Runtime

HTML template tag

The HTML tag the component can be associated with in an HTML template. Assign the ID attribute with a unique value and set the identical value to the ElementID property. Detailed information can be found in the Use of HTML templates topic.

HTML tag <IMG ID=”UniqueID”>
ElementID UniqueID

Properties for TWebImageControl

Property Description
AutoSize When true, the size of the control automatically adapts to the size of the image it contains
Base64Image: string Returns the image data as base64 string
ElementClassName Optionally sets the CSS classname for the label when styling via CSS is used
ElementID Optionally sets the HTML element ID for a HTML element in the form HTML file the label needs to be connected with. When connected, no new label is created but the Delphi class is connected with the existing HTML element in the form HTML file
Picture Sets the picture at design time. Note that the image is automatically deployed by the compiling process to a separate image file with a unique name.
URL Specifies the image as an URL

Methods for TWebImageControl

Method Description
DataURL: string Returns the image control image content as data URL string
DataURL(Width, Height: Integer): string; Returns the image control image content at size width/height as data URL string
ImageHeight: Integer Function returning the original image height
ImageWidth: Integer Function returning the original image width
LoadFromArrayBuffer(AArray: TJSArrayBuffer) Loads the image from a binary array
LoadFromURL(AURL) Async function to load the image from an URL
LoadFromURL(AURL; ImageLoaded: TImageLoadedProc; ImageError: TImageErrorProc Function to load image from an URL with anonymous method handlers
ResizeImage(AWidth, AHeight: Integer); Resizes the image to a new width/height
ResizeImage(AWidth, AHeight: Integer; AspectRatio: Boolean); Resizes the image to a new width/height maintaining the aspect ratio

Events for TWebImageControl

Event Description
OnClick Event triggered when the image is clicked
OnDblClick Event triggered when the image is doubleclicked
OnLoaded Event triggered when the image load completed after assigning the URL or DataURL