保
保龙
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TForm1.Button1Click(Sender: TObject);<br>var<br> i:integer;<br>begin<br> for i:=0 to 1000 do<br> begin<br> sleep(100); //转让控制权,但按其它按钮时不能向应<br> form1.Text:=inttostr(i);<br> end;<br>end;<br><br>procedure TimeDelay(Dtouble);<br>var<br> TTouble;<br>begin<br> TT:=GetTickCount();<br> while GetTickCount()-TT<DT do<br> Application.ProcessMessages;<br>end;<br><br>procedure TForm1.Button2Click(Sender: TObject);<br>var<br> TTouble;<br> i:integer;<br>begin<br> for i:=0 to 1000 do<br> begin<br> TimeDelay(100); //程序延时后按按钮有向应,但CPU资源使用100%<br> form1.Text:=inttostr(i);<br> end;<br>end;<br>