Patrick Quinn
United Kingdom
81 Posts |
Posted - Aug 10 2012 : 00:05:49
|
Here's how I am dong it. There is an ImageEn demo too. Note that I am using TABSTable from Absolute Database, a BDE replacement, but code using BDE will be almost identical - just use a TTable and TBlobstream instead. The line creating the Blobstream will be slightly different too.
Absolute Database: http://www.componentace.com/bde_replacement_database_delphi_absolute_database.htm
procedure FillImageEnMViewFromTable(ImageEnMView: TImageEnMView; ABSTable: TABSTable; sFieldName: string); var MemStream: TMemoryStream; BlobStream: TABSBlobStream; OrigRec, i: integer; begin ImageEnMView.Clear; with ABSTable do begin OrigRec := RecNo; First; while not EOF do begin MemStream := TMemoryStream.Create; try // The next line needs changing for BDE BlobStream := TABSBLOBStream(ABSTable.CreateBlobStream(ABSTable.FieldByName(sFieldname), bmRead)); try MemStream.CopyFrom(BlobStream, BlobStream.Size); MemStream.Position := 0; // Don't forget this! with ImageEnmView do begin i := AppendImage; SetImageFromStream(i, MemStream); ImageID[i] := RecNo; end; finally BlobStream.Free; end; finally MemStream.Free; end; Next; end; RecNo := OrigRec; end; end;
Hope that helps.
Patrick |
|
|