显示图像问题?在线等待给分! (50分)

  • 主题发起人 小女人
  • 开始时间

小女人

Unregistered / Unconfirmed
GUEST, unregistred user!
在我的数据库里有一个"TU"字段,字段内容是"img/cdp.bmp"是一个图像路径。
问:如何在image1里显示此图片?
 

image1.Picture.LoadFromFile('TU字段内容');
 
procedure TForm1.Button1Click(Sender: TObject);
var
s:string;
begin
s:=Trim(Table1.fieldByName('TU').asstring);
image1.picture.loadfromfile('绝对路径/'+s);
end;
 
我用的是ado连接数据库,ADOQuery1在fprm2窗口中。
我用这一句,结果报错,应该怎么写?
image1.Picture.LoadFromFile('form2.ADOQuery1cp1.value');
 
image1.Picture.LoadFromFile(form2.ADOQuery1cp1.value);
 
看来快好了,现在错误提示是:cannot open file imbmp/lycp1.bmp.
看来路径已经被读过去了,只是打不开?
是不是一定要用绝对路径?
 
在哪个目录下,前面加上绝对路径: 'd:/temp/'+...
 
看你的图片位置对不?
 
软件被安装后路径不一定是什么?所以怎么获得当前的绝对路径呢?
 
image1.Picture.LoadFromFile(ExtractFilePath(Application.ExeName)+form2.ADOQuery1cp1.value);
 
这回问题大了,错误信息为
project menu.exe raised exception class efopenerror with message 'cannot open file
c:/program files/datab/imbmp/lycp1.bmp'.process stopped.use step or run to continue.
这是怎么回事呀?
 
你的图片不在c:/program files/datab/imbmp/路径下
 
你确定是存在这个图像文件?
 
问题解决,谢谢各位!~_~
 
多人接受答案了。
 
顶部