[Overview][Constants][Types][Classes][Procedures and functions][Index] Reference for unit 'DBCtrls' (#lcl)

TDBImage.LoadPicture

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

Declaration

Source position: dbctrls.pp line 1198

public procedure TDBImage.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

TDBImage.AutoDisplay

  

AutoDisplay - if True, automatically displays when focus is given.

TDBImage.PictureLoaded

  

Indicates if the graphic content for the data-aware control has been loaded from its linked dataset.

TDBImage.DataChange

  

Performs actions needed when the content in the linked dataset has been changed.

TDBImage.Field

  

Definition for the field in the linked dataset where the control value is stored.

TDBImage.DataField

  

Contains the name of the field with the value for the control.

TDBImage.DataSource

  

Provides access to the dataset with content for the control.

TDBImage.OnDBImageRead

  

Event to read a custom header from image stream.

TFieldDataLink.Field

  

The Field to which the datalink is attached.

TFieldDataLink.FieldName

  

FieldName - the name of the attached field, stored as a string.

TDataLink.DataSet

TDataLink.DataSource

TCustomImage.Picture

  

Contains the image displayed in the control.

TPicture.Graphic

  

Graphic - The TGraphic object contained by the TPicture.


Version 3.2 Generated 2024-02-25 Home