Board index » delphi » TImagelist

TImagelist

Does anyone know how to save and load the content of a timagelist?
I tried the Tblobstream method, but can't seem to get it to work.

Best regards

Troels Kjerulf ( t...@scandiplan.dk )

 

Re:TImagelist


I failed to get the TBlobStream stuff working also, but if you are
loading and saving to/from a InterBase Blob Sub_Type -1 field, the
following works:

Place a TDBImage on you form (set visible to False if you don't want the
user to see it).

Then as you read from the database, on each record:
  // assign the bitmap
  DBImage1.Picture.Bitmap.Assign(Query1.FieldByName('Icon'));
  // check for no bitmap
  if ( not BDImage1.Picture.Bitmap.Empty ) then
    ImageList1.Add(DBImage1.Picture.Bitmap,nil);

To write, I've use a TTable:
  // get into edit mode
  Table1.Edit;
  // get the bitmap
  ImageList1.GetBitmap(ImageIndex,DBImage1.Picture.Bitmap);
  DBImage1Down.Refresh;
  // save the image
  Table1.Post;
  // close the table
  Table1.Close;

I haven't tried a TQuery for saving, but it should work also.

Dave.

Quote
Troels Kjerulf wrote:
> Does anyone know how to save and load the content of a timagelist?
> I tried the Tblobstream method, but can't seem to get it to work.

> Best regards

> Troels Kjerulf ( t...@scandiplan.dk )

Other Threads