H
halqj
Unregistered / Unconfirmed
GUEST, unregistred user!
数据库中保存的是JPG格式的图片,采用QRImage来显示并打印,我在OnNeedData事件中加入如下代码:
procedure TFrmprint.QuickRep1NeedData(Sender: TObject;
var MoreData: Boolean);
var
tempstream:TStringStream;
tempjpeg:TJPEGImage;
begin
if TBlobField(Table1.FieldByName('photo')).IsNull = false then
begin
try
tempstream:=TStringStream.Create('');
TBlobField(Table1.FieldByName('photo')).SaveToStream(tempstream);
tempstream.Position:=0;
tempjpeg:=TJPEGImage.Create;
tempjpeg.LoadFromStream(tempstream);
QRImage1.Picture.bitmap.Assign(tempjpeg);
finally
tempstream.Free;
tempjpeg.Free;
end;
end else
begin
QRimage1.Picture :=nil;
end;
end;
采用了这种方法数据库中的JPG图片怎么连预览都没出来,大家给指点指点问题所在?
procedure TFrmprint.QuickRep1NeedData(Sender: TObject;
var MoreData: Boolean);
var
tempstream:TStringStream;
tempjpeg:TJPEGImage;
begin
if TBlobField(Table1.FieldByName('photo')).IsNull = false then
begin
try
tempstream:=TStringStream.Create('');
TBlobField(Table1.FieldByName('photo')).SaveToStream(tempstream);
tempstream.Position:=0;
tempjpeg:=TJPEGImage.Create;
tempjpeg.LoadFromStream(tempstream);
QRImage1.Picture.bitmap.Assign(tempjpeg);
finally
tempstream.Free;
tempjpeg.Free;
end;
end else
begin
QRimage1.Picture :=nil;
end;
end;
采用了这种方法数据库中的JPG图片怎么连预览都没出来,大家给指点指点问题所在?