J jefflau Unregistered / Unconfirmed GUEST, unregistred user! 2007-07-28 #1 我在button1事件中添加了一个for循环,循环很大,当我按下时开始执行,我想在button2按下就停止button1的for循环,也就是停止button1的事件,请问该如何解决?
L liyinwei Unregistered / Unconfirmed GUEST, unregistred user! 2007-07-28 #3 var bExit: Boolean; procedure TForm1.Button1Click(Sender: TObject); var i: Integer; begin bExit := False; for i := 0 to 10000000 do begin ...... Application.ProcessMessages; if bExit then Break; end; end; procedure TForm1.Button2Click(Sender: TObject); begin bExit := True; end;
var bExit: Boolean; procedure TForm1.Button1Click(Sender: TObject); var i: Integer; begin bExit := False; for i := 0 to 10000000 do begin ...... Application.ProcessMessages; if bExit then Break; end; end; procedure TForm1.Button2Click(Sender: TObject); begin bExit := True; end;
J jefflau Unregistered / Unconfirmed GUEST, unregistred user! 2007-07-28 #4 Application.ProcessMessages; 原来我少了这一句,高手,加你分[]