Button 直到btnStop.Click=True;
问题:btnClick触发重复循环,我希望在单击btnStop时重复循环停止,然后lblLetter将显示单击btnStop时屏幕上的字母Button 直到btnStop.Click=True;,button,click,repeat,until-loop,Button,Click,Repeat,Until Loop,问题:btnClick触发重复循环,我希望在单击btnStop时重复循环停止,然后lblLetter将显示单击btnStop时屏幕上的字母 TForm1 = class(TForm) lblLetter: TLabel; btnSelect: TButton; btnStop: TButton; const arrLetter:array[1..22] of string = ('A','B','C','D','E','F','G','H','I','J','K','
TForm1 = class(TForm)
lblLetter: TLabel;
btnSelect: TButton;
btnStop: TButton;
const
arrLetter:array[1..22] of string = ('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','R','S','T','U','V','W');
procedure TForm1.btnSelectClick(Sender: TObject);
var
k, letter:integer;
bstop: boolean;
begin
repeat
k:= Random(22)+1 ;
lblLetter.Caption:= inttostr (k);
Sleep(300)
until
btnStop.Click = true;
lblLetter.Caption:= inttostr (k);