J jog81 Unregistered / Unconfirmed GUEST, unregistred user! 2002-12-03 #1 有谁知道Timage控件如何动态调用图片?! 我想把图片放在一个文件夹里,程序运行时再调用它。 这样可以做到吗?请各位高手指导!
J jsxjd Unregistered / Unconfirmed GUEST, unregistred user! 2002-12-03 #2 procedure TForm1.Button1Click(Sender: TObject); begin image1.Picture.Bitmap.LoadFromFile('c:/windows/forest.bmp'); image1.autosize:=true; end; procedure TForm1.Button2Click(Sender: TObject); begin image1.Picture.Bitmap.LoadFromFile('c:/windows/bubbles.bmp'); image1.autosize:=true; end;
procedure TForm1.Button1Click(Sender: TObject); begin image1.Picture.Bitmap.LoadFromFile('c:/windows/forest.bmp'); image1.autosize:=true; end; procedure TForm1.Button2Click(Sender: TObject); begin image1.Picture.Bitmap.LoadFromFile('c:/windows/bubbles.bmp'); image1.autosize:=true; end;
春 春意 Unregistered / Unconfirmed GUEST, unregistred user! 2002-12-03 #3 image1.Picture.LoadFromFile ('aaa.bmp');//当前路径
H huawdg Unregistered / Unconfirmed GUEST, unregistred user! 2002-12-03 #4 image1.picture.loadfromfile(filename);
J jog81 Unregistered / Unconfirmed GUEST, unregistred user! 2002-12-03 #5 请问如何使图片只要在程序文件夹里就可以调用? 楼上的大侠说的方法必须写出完整的路径才能使用! 可是程序如果安装在别的地方就不行了!
J jsxjd Unregistered / Unconfirmed GUEST, unregistred user! 2002-12-03 #6 image1.Picture.Bitmap.LoadFromFile('forest.bmp'); 或 image1.Picture.Bitmap.LoadFromFile(extractFilePath(ExtractFilePath(Application.EXEName))+'forest.bmp');
image1.Picture.Bitmap.LoadFromFile('forest.bmp'); 或 image1.Picture.Bitmap.LoadFromFile(extractFilePath(ExtractFilePath(Application.EXEName))+'forest.bmp');
A ahai227 Unregistered / Unconfirmed GUEST, unregistred user! 2002-12-03 #7 ExtractFilepath(Application.ExeName); 得到执行程序的路径。然后............
春 春意 Unregistered / Unconfirmed GUEST, unregistred user! 2002-12-03 #8 或者: var dir:string; begin dir:=GetCurrentDir(); dir:=dir+'forest.bmp'; image1.Picture.Bitmap.LoadFromFile(dir); end; 祝你成功!!
或者: var dir:string; begin dir:=GetCurrentDir(); dir:=dir+'forest.bmp'; image1.Picture.Bitmap.LoadFromFile(dir); end; 祝你成功!!