有谁明白那个dbimage怎么用?急,我连上后怎么说有错误,我用table连的。急呀。(50分)

  • 主题发起人 主题发起人 mf_studio
  • 开始时间 开始时间
M

mf_studio

Unregistered / Unconfirmed
GUEST, unregistred user!
有谁明白那个dbimage怎么用?急,我连上后怎么说有错误,我用table连的。急呀。
 
原因有以下几种:
1.table没激活table.active:=true;
2.没用datasource,
3.没有为dbimage指定datasource和datafield
 
出什么错误呀??
说出来听听
DBImage很好用的呀,你连上Datasource和Field就可以用了
你说的不好用是说不知如何导入数据吧,我给你自己写一套源码,可以使用DBImage
导入bmp,jpg文件
源码如下:
==============================
type
TPicType = (bmp, jpg);
//把图象文件导入到TDBImage控件中
procedure SaveToDBImage(APicType: TPicType; AFileName: string; ADBImage: TDBImage);
var
myJpg: TJpegImage;
begin
if (ADBImage.DataSource.State = dsEdit) or (ADBImage.DataSource.State = dsInsert) then
begin
if APicType = bmp then
begin
ADBImage.Picture.LoadFromFile(AFileName);
exit;
end;

if APicType = jpg then
begin
myJpg := TJpegImage.Create;
try
myJpg.LoadFromFile(AFileName);
ADBImage.Picture.Graphic.Assign(myJpg);
finally
myJpg.Free;
end;
end;
end;
end;

//把TDBImage控件图象导出到图象文件中
procedure LoadFromDBImage(APicType: TPicType; AFileName: string; ADBImage: TDBImage);
var
myJpg: TJpegImage;
begin
if APicType = bmp then
begin
ADBImage.Picture.SaveToFile(AFileName);
exit;
end;

if APicType = jpg then
begin
myJpg := TJpegImage.Create;
try
myJpg.Assign(ADBImage.Picture.Graphic);
myJpg.SaveToFile(AFileName);
finally
myJpg.Free;
end;
end;
end;
=================================
还不够简练,凑合着用吧
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
后退
顶部