请教高手,如何在while循环中还能点击其他的按钮等操作呀,我知道VB里面有do event,delphi里面应该如何做呀,希望高手指点,解决后立即结贴!谢谢!

解决方案 »

  1.   

    procedure TForm1.Button2Click(Sender: TObject);
    begin
      while True do begin
        Caption := Format('%.6f', [Now]);
        Application.ProcessMessages;
        if CheckBox1.Checked then Exit;
      end;
    end;
      

  2.   

    procedure TForm1.Button1Click(Sender: TObject);
    var
      i:integer;
    beginbegin
      i:=0;
      While  i<= 1000000 do
      begin
        Application.ProcessMessages;
        Edit1.Text:=Inttostr(i);
        i:=i+1;
      end;
    end;
    end;
    应该可以
      

  3.   

    楼上的对。
    VB:DOEVENTS
    DELPHI:Application.ProcessMessages;
    两者等价
      

  4.   

    procedure TForm1.Button2Click(Sender: TObject);
    begin
      while True do begin
        FORM1.Caption := Format('%.6f', [Now]);
        Application.ProcessMessages;
        if CheckBox1.Checked then Exit;
      end;
    end;
      

  5.   

    我是说没有任何条件的,在while循环的时候随便做什么都可以,有什么解决方法吗?
      

  6.   

    在while循环里面用Application.ProcessMessages;的话,好像只是不能关闭窗体,其他的应该都可以操作的吧