读书人

请指点怎样用Delphi写保存与查询BMP

发布时间: 2012-02-29 16:44:11 作者: rapoo

请各位高手指点,怎样用Delphi写保存与查询BMP图像,求急!谢谢!
请各位高手指点,怎样用Delphi写保存与查询BMP图像,求急!谢谢!

[解决办法]
以前答的一个问题,BMP也可以的
http://community.csdn.net/Expert/topic/5375/5375745.xml?temp=.2708704
[解决办法]
procedure TDAGoodsEditForm.dsGoodsEdieDataChange(Sender: TObject;
Field: TField);
var
imgStream: TMemoryStream;
jpg: TJPEGImage;
begin
inherited;
if not tblGoodsEdit.FieldByName( 'GoodsPictrue ').IsNull then
begin
try
try
imgStream := TMemoryStream.Create;
TBlobField(tblGoodsEdit.FieldByName( 'GoodsPictrue ')).SaveToStream(imgStream);
imgStream.Seek(0, soFromBeginning);
jpg := TJPEGImage.Create;
jpg.LoadFromStream(imgStream);
imgProduct.Picture.Assign(jpg);
except
imgProduct.Picture := nil;
end;
finally
imgStream.Free;
jpg.Free;
end;
end
else
begin
imgProduct.Picture := nil;
end;
end;

procedure TDAGoodsEditForm.imgProductDblClick(Sender: TObject);
var
sImgFile: string;
begin
inherited;
if OpenPicDlg.Execute then
begin
sImgFile := OpenPicDlg.FileName;
imgProduct.Picture.LoadFromFile(sImgFile);
TBlobField(tblGoodsEdit.FieldByName( 'GoodsPictrue ')).LoadFromFile(sImgFile);
end
end;

读书人网 >.NET

热点推荐