Z
zfnet
Unregistered / Unconfirmed
GUEST, unregistred user!
(sql数据库)
为啥我读出来的图像文件不对(是黑色一片,图片有1M大)
读图像文件:
...
var
BlobStream:TBlobStream;
FileStream: TFileStream;
bagin
...
if FileExists(ExtractFilePath(Application.ExeName)+'temp.bmp') then
deletefile(ExtractFilePath(Application.ExeName)+'temp.bmp');
BlobStream:=TBlobStream.Create(query3.fieldbyname('zp')as tblobfield,bmRead);
FileStream := TFileStream.Create(ExtractFilePath(Application.ExeName)
+'temp.bmp',fmCreate or fmOpenWrite);
FileStream.CopyFrom(BlobStream, BlobStream.Size);
FileStream.Free;
BlobStream.Free;
image1.Picture.Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName)+'temp.bmp');
image1.Stretch:=true;
....
=====
为啥我读出来的图像文件不对(是黑色一片,图片有1M大)
读图像文件:
...
var
BlobStream:TBlobStream;
FileStream: TFileStream;
bagin
...
if FileExists(ExtractFilePath(Application.ExeName)+'temp.bmp') then
deletefile(ExtractFilePath(Application.ExeName)+'temp.bmp');
BlobStream:=TBlobStream.Create(query3.fieldbyname('zp')as tblobfield,bmRead);
FileStream := TFileStream.Create(ExtractFilePath(Application.ExeName)
+'temp.bmp',fmCreate or fmOpenWrite);
FileStream.CopyFrom(BlobStream, BlobStream.Size);
FileStream.Free;
BlobStream.Free;
image1.Picture.Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName)+'temp.bmp');
image1.Stretch:=true;
....
=====