//定义一个显示图片的过程(这里是一个类的过程)参考:http://www.cnblogs.com/del88/archive/2012/02/03/2337566.html
procedure ImgShow(top_img_type: string; ImageXuhao: TImage);
var
pic_path: string;
begin
if top_img_type = 'loading' then
begin
pic_path := ExtractFilePath(ParamStr(0)) + 'img\gif\loading.gif';
ImageXuhao.Picture.LoadFromFile(pic_path);
// AnimationSpeed 设定动画速度,值越大,速度越快
TGIFImage(ImageXuhao.Picture.Graphic).AnimationSpeed := 300;
TGIFImage(ImageXuhao.Picture.Graphic).Animate := True;
ImageXuhao.Refresh;{这句必须加,否则会显示延迟}
end else if top_img_type = 'true' then begin
pic_path := ExtractFilePath(ParamStr(0)) + 'img\gif\true.gif';
ImageXuhao.Picture.LoadFromFile(pic_path);
ImageXuhao.Refresh;{这句必须加,否则会显示延迟}
end else begin
pic_path := ExtractFilePath(ParamStr(0)) + 'img\gif\false.gif';
ImageXuhao.Picture.LoadFromFile(pic_path);
ImageXuhao.Refresh;{这句必须加,否则会显示延迟}
end;
end;

调用:ImgShow('false',ImageXuhao1);

posted on 2012-02-11 13:15  del88  阅读(5)  评论(0编辑  收藏  举报