W
wooosir
Unregistered / Unconfirmed
GUEST, unregistred user!
在下面的代码中,我想实现Button1Click和Button2Click中的Delay交替执行,
实际上只有后触发的ButtonClick中的Delay执行,请各位帮忙看看。
procedure Delay(MSecs: Longint);
var
start,Now: Longint;
begin
start:=GetTickCount;
repeat
Application.ProcessMessages;
Now:=GetTickCount;
until(Now-start>=MSecs) or (Now<start);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
while truedo
delay(550);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
while truedo
delay(550);
end;
实际上只有后触发的ButtonClick中的Delay执行,请各位帮忙看看。
procedure Delay(MSecs: Longint);
var
start,Now: Longint;
begin
start:=GetTickCount;
repeat
Application.ProcessMessages;
Now:=GetTickCount;
until(Now-start>=MSecs) or (Now<start);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
while truedo
delay(550);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
while truedo
delay(550);
end;