在迴圈中加入 Application.ProcessMessages;
EX:
procedure TForm1.BitBtn1Click(Sender: TObject);
var I : Integer;
begin
IF TBitBtn(Sender).Tag = 1 then
Begin
Application.ProcessMessages;
BitBtn2.Enabled := True;
BitBtn3.Enabled := True;
for I:= 0 TO 100 Do
Begin
Label3.Caption := IntToStr(I);
sleep(100);
End;
End
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
BitBtn2.Enabled := False;
BitBtn3.Enabled := False;
end;
沒有留言:
張貼留言