Sign in Join
FPDoc Onlineexperiment

TDBImage.LoadPicture procedure

Member of TDBImagepublicIn unit DBCtrls

Loads the graphic content for the control from a field in the linked dataset.

Declaration

pascal
procedure LoadPicture; virtual

Description

LoadPicture is a procedure used to load the graphic content into the image control from the field in the linked dataset. DataField contains the field name with the value for the control. DataSource is the component which provides access to the dataset with the specified field name.

LoadPicture uses the internal TFieldDataLink in the class instance to access the dataset and the field definition used in the operation. The Field is assigned to the Picture in the control when it is not already in use. If the Field is a BLOB field type, a BLOB stream is created and used to load the content in Picture.

LoadPicture uses the OnDBImageRead event handler (when assigned) to identify and load the graphic header and content for the image. When OnDBImageRead is implemented, it is assumed that a known graphic type is processed in its entirety in the handler. Otherwise, an invalid graphic type is returned and the remainder of the stream content is the graphic image data. In particular, returning an invalid graphic class while the stream contains an image header will not work.

If OnDBImageRead is not used, the ReadImageHeader method is called and the content for the graphic type is read and assigned to the Picture in the control.

LoadPicture is called when the value in the AutoDisplay property is changed to True, and from the implementation of the DataChange method.

Use PictureLoaded to determine if LoadPicture has already been called for the current record in the linked dataset.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.