怎么用timer来实现几张图片的动态切换,闪烁 怎样实现间隔一定的时间读取另一张图片。( 控件timer()的用法 ) 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 能不能给我一些具体一点的代码啊,用delphi的timer 如果图片是用文件保存的:(比如4张图片:1.bmp 2.bmp 3.bmp 4.bmp)var PicIndex: Integer;formcreate : picIndex := 1;procedure TForm1.Timer1OnTimer(Sender: TObject);begin Image1.Picture.Graphic.LoadFromFile('路径...' + IntToStr(picIndex) + '.bmp'); Inc(picIndex); if picIndex = 5 then picIndex := 1;end;如果是保存在资源文件里面,就要用LoadResource(HInstance, '资源名称')了.一样的办法,切换 怎么设置让它只循环两次啊也就是只切换一次图片就好楼上的大哥,需不需要利用Timer1.Interval来实现 啊 要只循环两次的话,那就:到两次之后,就将timer的enabled设为false. timer的interval属性,是用来设置切换的时间间隔的.毫秒为单位. 假设我的文件在E:\第三方控件\image有两张图片:1.bmp,2.bmp我这样写:var PicIndex: Integer; formcreate : picIndex := 1; procedure TForm1.Timer1OnTimer(Sender: TObject); begin Image1.Picture.Graphic.LoadFromFile('E:\第三方控件\image' + IntToStr(picIndex) + '.bmp'); Inc(picIndex); if picIndex = 3 then picIndex := 1; end; 怎么会出现错误呢,还有请教一下大哥,我想设置成一秒钟切换那么Timer1.Interval怎么用在里面啊 假设我的文件在E:\第三方控件\image 有两张图片:1.bmp,2.bmp 我这样写 :var PicIndex: Integer; formcreate : picIndex := 1; procedure TForm1.Timer1OnTimer(Sender: TObject); begin Image1.Picture.Graphic.LoadFromFile('E:\第三方控件\image' + IntToStr(picIndex) + '.bmp'); Inc(picIndex); if picIndex = 3 then picIndex := 1; end; 怎么会出现错误呢,还有请教一下大哥,我想设置成一秒钟切换 那么Timer1.Interval怎么用在里面啊 .........无语了,你刚用delphi?好吧,我尽量说得傻瓜一点.你把1.bmp 和2.bmp放到你的执行文件的同一个目录里面.在代码中找到:private { Private declarations }的地方.在它下面加上: picIndex: Integer;然后双击form空白处,会自动产生FormCreate的代码,如下:procedure TForm1.Form1Create(Sender: TObject);begin //在里面加上: picIndex := 1;end; 在Timer1的OnTimer事件里面写:procedure TForm1.Timer1OnTimer(Sender: TObject);begin //这里填上代码: Image1.Picture.Graphic.LoadFromFile(ExtractFilePath(ParamStr(0)) + IntToStr(picIndex) + '.bmp'); Inc(picIndex); //这句的作用就是: picIndex := picIndex + 1; if picIndex = 3 then picIndex := 1;end; 1秒钟切换一次的话,你将Timer的interval属性设置为1000就行了. 1000毫秒=1秒.如果你没改过的话,默认的就是1000 真的很谢谢了麻烦你了,我是刚开始用delphi我原来就是按你的这样做的文件怎么提去不出来啊我都放在这个工程文件的同目录下的image下面出现Access violation at address 0052e286....然后我把两个图片从image文件下拷贝到工程文件的同目录下也同样出错我想是找不到文件名吧还有怎么将Timer1.Interval=1000用到里面啊麻烦了大哥 procedure TForm1.Form1Create(Sender: TObject); begin picIndex := 1; Timer1.Interval := 1000; Timer1.Enabled := true;end; procedure TForm1.Timer1OnTimer(Sender: TObject); var strFileName: string;begin strFileName := ExtractFilePath(ParamStr(0)) + IntToStr(picIndex) + '.bmp'; if not FileExists(strFileName) then begin Timer1.Enabled := False; ShowMessage(strFileName + '文件不存在'); end; Image1.Picture.Graphic.LoadFromFile(strFileName); Inc(picIndex); //这句的作用就是: picIndex := picIndex + 1; if picIndex = 3 then picIndex := 1; end; Image1.Picture.Graphic.LoadFromFile(strFileName); 老是出错,运行就会出现:Access violation at address 0052e286.... 我已经放在和工程所在文件夹下面了啊 大哥,可以了,谢谢了啊 把这句话中的Image1.Picture.Graphic.LoadFromFile(strFileName); graphic去掉就可以了Image1.Picture.LoadFromFile(strFileName); 其他窗口要调用MainForm.Timer1Timer(Sender: TObject);里面的参数是什么 各层TRY EXCEPT之间的关系. delphi + access 登陆模块的密码修改 Borland Developer Studio 2006 没有 CORBA ?? 找硬盘 请问这样的表格用什么控件如何画出来? 建议:法定某一天为程序员节,哈哈,散分了 为什么这样对我!!!!!!!!!!!!!!!!为什么~~~!!!!!!!!!!!!!!! 能提供一点编写“俄罗斯方块”的算法和思路吗? 如何写这条SQL 窗体 本人是个菜鸟,希望有人把with语句给我还原下,在把这些语句能给我祥解下! 很很很简单问题...想不明白..
var
PicIndex: Integer;formcreate : picIndex := 1;
procedure TForm1.Timer1OnTimer(Sender: TObject);
begin
Image1.Picture.Graphic.LoadFromFile('路径...' + IntToStr(picIndex) + '.bmp');
Inc(picIndex);
if picIndex = 5 then picIndex := 1;
end;
如果是保存在资源文件里面,就要用LoadResource(HInstance, '资源名称')了.
一样的办法,切换
也就是只切换一次图片就好
楼上的大哥,需不需要利用Timer1.Interval来实现 啊
有两张图片:1.bmp,2.bmp
我这样写
:var
PicIndex: Integer; formcreate : picIndex := 1;
procedure TForm1.Timer1OnTimer(Sender: TObject);
begin
Image1.Picture.Graphic.LoadFromFile('E:\第三方控件\image' + IntToStr(picIndex) + '.bmp');
Inc(picIndex);
if picIndex = 3 then picIndex := 1;
end;
怎么会出现错误呢,还有请教一下大哥,我想设置成一秒钟切换
那么Timer1.Interval怎么用在里面啊
有两张图片:1.bmp,2.bmp
我这样写 :
var
PicIndex: Integer; formcreate : picIndex := 1;
procedure TForm1.Timer1OnTimer(Sender: TObject);
begin
Image1.Picture.Graphic.LoadFromFile('E:\第三方控件\image' + IntToStr(picIndex) + '.bmp');
Inc(picIndex);
if picIndex = 3 then picIndex := 1;
end;
怎么会出现错误呢,还有请教一下大哥,我想设置成一秒钟切换
那么Timer1.Interval怎么用在里面啊
private
{ Private declarations }
的地方.
在它下面加上:
picIndex: Integer;然后双击form空白处,会自动产生FormCreate的代码,如下:
procedure TForm1.Form1Create(Sender: TObject);
begin //在里面加上:
picIndex := 1;end;
在Timer1的OnTimer事件里面写:
procedure TForm1.Timer1OnTimer(Sender: TObject);
begin //这里填上代码:
Image1.Picture.Graphic.LoadFromFile(ExtractFilePath(ParamStr(0)) + IntToStr(picIndex) + '.bmp');
Inc(picIndex); //这句的作用就是: picIndex := picIndex + 1;
if picIndex = 3 then picIndex := 1;
end;
麻烦你了,我是刚开始用delphi
我原来就是按你的这样做的
文件怎么提去不出来啊
我都放在这个工程文件的同目录下的image下面
出现Access violation at address 0052e286....
然后我把两个图片从image文件下拷贝到工程文件的同目录下
也同样出错
我想是找不到文件名吧
还有怎么将Timer1.Interval=1000用到里面啊
麻烦了大哥
begin picIndex := 1;
Timer1.Interval := 1000;
Timer1.Enabled := true;end; procedure TForm1.Timer1OnTimer(Sender: TObject);
var
strFileName: string;
begin
strFileName := ExtractFilePath(ParamStr(0)) + IntToStr(picIndex) + '.bmp';
if not FileExists(strFileName) then
begin
Timer1.Enabled := False;
ShowMessage(strFileName + '文件不存在');
end;
Image1.Picture.Graphic.LoadFromFile(strFileName);
Inc(picIndex); //这句的作用就是: picIndex := picIndex + 1;
if picIndex = 3 then picIndex := 1;
end;
老是出错,运行就会出现:Access violation at address 0052e286....
我已经放在和工程所在文件夹下面了啊
把这句话中的Image1.Picture.Graphic.LoadFromFile(strFileName);
graphic去掉就可以了
Image1.Picture.LoadFromFile(strFileName);
里面的参数是什么