急救!!!delphi中编写多线程程序出现list out of bounds(????),怎么解决 急救!!!delphi中编写多线程程序出现list out of bounds(????),怎么解决各位高手,为什么??????????谢谢! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 procedure TAnimThread.Execute; var i:integer; begin for i:=0 to 12 do begin Synchronize(ChangeXY);//改变动态生成image的位置 sleep(800); end; threadimage.free; freeonterminate:=true; end; Synchronize是你自己编的吧?反正就是数组越界呗,在Synchronize里慢慢找总能找到的. procedure TAnimThread.ChangeXY; var cur_x,cur_y:Integer; begin try begin Threadimage.hide; cur_x:=source_x + trunc((destination_x - source_x)/13) * cur_count; cur_y:=source_y + trunc((destination_y - source_y)/13) * cur_count; cur_count:=cur_count + 1; ThreadImage.Left:=cur_x; ThreadImage.Top :=cur_y; threadimage.show; end except end; end; ThreadImage.Left 或是 ThreadImage.Top 超出范围。 cur_count:=cur_count + 1;这里会无限增大的! 在线程中每调用一次 ChangeXY ,cur_count 就会加1,如此下去就会超出范围! 你在改变list的时候并且进行了排序操作! 我也遇到,不过是TMemoryStream时 一个人学习VCL真的很纠结,有人一起吗? ExeRes.com 全心打造 IntraWeb for Delphi 完美体验 (2.0版 现已全面开放源码) Dll里为何不能动态建立AdoQuery? 等咱有了钱---女生版 我能不能即用except 又用finally请问怎么写 兄弟看一下! 请教高手:关于控件Dock操作的问题 请问用什么开发数据库语言? 关于Netbios 为什么我的程序在有些机上提示“ADO找不到提供者” ISAPI程序如何读取文件列表? 急!!!在线等待---DbiPackTable需要什么头文件?
var i:integer;
begin
for i:=0 to 12
do
begin
Synchronize(ChangeXY);//改变动态生成image的位置
sleep(800);
end;
threadimage.free;
freeonterminate:=true;
end;
反正就是数组越界呗,在Synchronize里慢慢找总能找到的.
var cur_x,cur_y:Integer;
begin
try
begin
Threadimage.hide;
cur_x:=source_x + trunc((destination_x - source_x)/13) * cur_count;
cur_y:=source_y + trunc((destination_y - source_y)/13) * cur_count;
cur_count:=cur_count + 1;
ThreadImage.Left:=cur_x;
ThreadImage.Top :=cur_y;
threadimage.show;
end
except
end;
end;
如此下去就会超出范围!