这种程序我做过,必须用数据流的形式,这个问题我曾经琢磨了一周,才做出来,部分
模式如下:
procedure Tform1.UpdatePicToBlob();
var
JPEGImage: TJPEGImage;
BlobStream: TBlobStream;
bmp:TBitmap;
bmMode : TBlobStreamMode;
begin
try
if clipboard.HasFormat(CF_BITMAP) then
begin
bmp:=TBitmap.Create ;
JPEGImage:=TJPEGImage.Create ;
bmp.Assign(clipboard);
JPEGImage.Assign(bmp);
JPEGImage.Compress;
if table1.state=dsInsert then
bmmode:=bmWrite
else
begin
bmmode:=bmReadWrite;
Table1.edit;
end;
BlobStream := TBlobStream.Create(Table1zp, bmMode);
try
JPEGImage.SaveToStream(BlobStream);
Image1.Picture.Assign(JPEGImage);
finally
BlobStream.Free;
JPEGImage.Free ;
end;
table1.Post ;
end
else
Application.MessageBox('错误','Open Error',MB_OK + MB_DEFBUTTON1)
except
;
end;
end;
肯定好用,我都在三个工程中使用了。