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);
问题:btnClick 触发重复循环,我希望在单击 btnStop 时停止重复循环,然后 lblLetter 将显示单击 btnStop 时屏幕上的字母。