频道分类

delphi 跳出FOR循环

作者:admin 来源:未知 日期:2010/4/29 12:07:55 人气: 标签:

 var 
bStop : Boolean;

procedure TForm1.btnStartClick(Sender: TObject);
var
iLoop : Integer;
begin
bStop := False;
for iLoop := 1 to 1000000000 do
begin
Application.ProcessMessages;
if bStop then
begin
ShowMessage (Format('Stop at %d!', [iLoop]));
break;
end;
end;
end;

procedure TForm1.btnStopClick(Sender: TObject);
begin
bStop := True;
end;