ImageEn, unit iemview

TImageEnMView.SetExternalMBitmap

TImageEnMView.SetExternalMBitmap

Declaration

procedure SetExternalMBitmap(MBitmap: TIECustomMultiBitmap);

Description

Allows a custom TIEMultiBitmap or TIEDBMultiBitmap object to be attached to the TImageEnMView. The TImageEnMView will automatically display changes to the attached Multi-Bitmap.

It is mainly used to make a TImageEnMView DB aware.

Note:
You must create and destroy the external multi-bitmap yourself
Use SetExternalMBitmap( nil ) to reset usage to the internal TIEMultiBitmap

Important!

It is recommended that you call SetExternalMBitmap(nil) before freeing your TIEMultiBitmap (to avoid potential issues when the TImageEnMView is destroyed).
extMBMP := TIEMultiBitmap.Create();
try
  ImageEnMView1.SetExternalMBitmap( extMBMP );
  ...
  Do something with extMBMP
  ...
finally
  ImageEnMView1.SetExternalMBitmap( nil );  // Ensure TImageEnMView does not point to invalid object
  extMBMP.Free();
end;

Example

// Create DB Aware TImageEnMView
procedure TMainForm.FormCreate(Sender: TObject);
begin
  ... Open a database table ...

  fDBMBitmap := TIEDBMultiBitmap.Create( DataSource1, 'Name', 'Image' );
  ImageEnMView1.SetExternalMBitmap( fDBMBitmap );
end;

procedure TMainForm.FormDestroy(Sender: TObject);
begin
  ImageEnMView1.SetExternalMBitmap( nil );
  FreeAndNil( fDBMBitmap );
end;