动态加载图片
type
showarrayrecord=record
showimage:Timage;
backpanel:tpanel;
filename:string[15];
end;
public
{ Public declarations }
jpgimage:Tjpegimage;
picturewidth,pictureheight,currentselectednum:integer;
showbararray:array[1..maxshowbmpnum]of showarrayrecord;
procedure TForm1.loadpicture(const filename:string;var destimage:timage);
begin
fileext:=ansilowercase(extractfileext(filename));
if fileext='.bmp' then
begin
destimage.picture.loadfromfile(filename);
picturewidth:=destimage.picture.width;
pictureheight:=destimage.picture.height;
end
else
if fileext='.jpg' then
begin
jpgimage.loadfromfile(filename);
destimage.picture.graphic:=jpgimage;
picturewidth:=destimage.picture.width;
pictureheight:=destimage.picture.height;
end;
end;