Q: 如何從 Blob 欄位中取得 Jpeg 圖形並加以顯示?
A: 參考下列程式碼 (from Brian Bushay (TeamB))
procedure TForm1.Table1AfterScroll(DataSet: TDataSet);
var
MS: TMemoryStream;
J1: TJPEGImage;
begin
J1 := TJPEGImage.Create;
MS := TMemoryStream.Create;
try
TBlobField(DataSet.Fields[1]).SaveToStream(MS);
MS.Seek(soFromBeginning, 0);
with J1 do begin
PixelFormat := jf24Bit;
Scale := jsFullSize;
Grayscale := False;
Performance := jpBestQuality;
ProgressiveDisplay := True;
ProgressiveEncoding := True;
LoadFromStream(MS);
end;
Image1.Picture.Graphic.Assign(J1);
finally
J1.Free;
MS.Free;
end;
end;
               (
geocities.com/huanlin_tsai)