代码如下:
procedure button1click()
var 
   count;integer;
begin
 count:=11; 
 while count<900 do
  begin
   for i:=1 to 888 do 
      begin 
       label1.caption:=inttostr(count+i);
       label1.refresh;
      end;
  if count=899 then 
      count:=11;
  end;
end.   ---此程序是一直在循环执行的
此程序类似什么抽奖方式的东西.能不能在某些时候,通过某些设置实现此程序的中断,让label1.caption的具体某个数值固定显示出来.不知道我是不是说清楚了,希望大侠们能帮我解决,谢谢你们的帮助.

解决方案 »

  1.   

    这样,不要每次都显示在label的caption中,中断了后再显示在label的caption中会更好,
      

  2.   

    var stop:boolean=false;
    procedure TForm1.Button1Click(Sender: TObject);
    var
        count,i:integer;
    begin
    stop:=false;
    count:=11;
     while true do
      begin
       for i:=1 to 888 do
          begin
           if stop then exit;
           label1.caption:=inttostr(count+i);
           label1.refresh;
           sleep(50);
           application.ProcessMessages;
          end;
          inc(count);
       if count>889 then count:=11;
      end;
    end;
    procedure TForm1.Button2Click(Sender: TObject);
    begin
      stop:=true;
    end;
      

  3.   

    你试试这样看看
      public
           re:integer;procedure TForm1.Button1Click(Sender: TObject);
    var   count:integer;
       i:integer;
    begin
     re:=0;
     count:=11;
     while count<900 do
      begin
       for i:=1 to 888 do
          begin       label1.caption:=inttostr(count+i);
            if re=1 then break;
           application.ProcessMessages;      end;
     if count=899 then
          count:=11;
          end;
    end;procedure TForm1.Button2Click(Sender: TObject);
    begin
    re:=1;
    end;end.
      

  4.   

    我想随时都可以是那个循环停下来,并且能显示停下来的时候,那个循环中count的数值,怎么实现啊?
      

  5.   

    你试试这样看看
      public
           re:integer;procedure TForm1.Button1Click(Sender: TObject);
    var   count:integer;
       i:integer;
    begin
     re:=0;
     count:=11;
     while count<900 do
      begin
       for i:=1 to 888 do
          begin       label1.caption:=inttostr(count+i);
            if re=1 then break;
           application.ProcessMessages;      end;
     if count=899 then
          count:=11;
          end;
    end;procedure TForm1.Button2Click(Sender: TObject);
    begin
    re:=1;
    end;end.