S
sun2003
Unregistered / Unconfirmed
GUEST, unregistred user!
//读取图片
procedure TFMW_M0201.ShowImage(Ige: TImage; DQ_Query: TADOQUERY;
FieldName: String);
var
TempStream: TStringStream;
TempJpeg: TJpegImage;
begin
try
TempStream := TStringStream.Create('');
TBlobField(DQ_QUERY.FieldByName(FieldName)).SaveToStream(TempStream);
Tempstream.position := 0;
TempJpeg := TJpegImage.Create;
TempJpeg.LoadFromStream(TempStream);
Ige.Picture.Bitmap.Assign(tempJpeg);
finally
TempStream.Free;
TempJpeg.Free;
end;
end;
如上代码只读JPEG图片。我从字段值中如何判断是多种不同类型的图象文件。如GIF、DIB等。
procedure TFMW_M0201.ShowImage(Ige: TImage; DQ_Query: TADOQUERY;
FieldName: String);
var
TempStream: TStringStream;
TempJpeg: TJpegImage;
begin
try
TempStream := TStringStream.Create('');
TBlobField(DQ_QUERY.FieldByName(FieldName)).SaveToStream(TempStream);
Tempstream.position := 0;
TempJpeg := TJpegImage.Create;
TempJpeg.LoadFromStream(TempStream);
Ige.Picture.Bitmap.Assign(tempJpeg);
finally
TempStream.Free;
TempJpeg.Free;
end;
end;
如上代码只读JPEG图片。我从字段值中如何判断是多种不同类型的图象文件。如GIF、DIB等。