1,185
社区成员




//定时器响应事件
procedure TfMain.Timer1Timer(Sender: TObject);
begin
//列表中一定要有内容
if fList.ListBox1.Count>0 then
begin
if Order then
begin
//顺行
if index<fList.ListBox1.Count-1 then
index:=index+1
else
index:=0;
end
else
begin
//逆行
if index>0 then
index:=index-1
else
index:=fList.ListBox1.Count-1;
end;
//获得图片
try
image1.Picture.LoadFromFile(fList.ListBox1.Items[index]);
fMain.Canvas.Lock;
fMain.Canvas.Draw(0,0,Image1.Picture.Graphic);
fMain.Canvas.Unlock;
Sleep(100);
except on E: Exception do
ShowMessage(e.Message);
end;
end
else
begin
Timer1.Enabled:=false;
Image1.Picture:=nil;
showmessage('该动画没有图像列表,请添加文件!');
end;
end;
3 如果图片大小和数量你无法控制, 最好做个数据缓冲以保证切换的流畅性
======================================
PS : 所提建议本人都做了相关测试, 但不能保证一定可以解决LZ遇到的问题