想实现按下按钮不松,数字累加怎么实现的?类似这样的。var
 i:integer;
begin
 i:=i+1;
 label1.caption:=inttostr(i);
end;试了一下,mousedown也不行啊。
vb可以。有何办法实现没有。

解决方案 »

  1.   

    while true do
     begin
      i:=i+1;
      label1.caption:=inttostr(i); 
     end;
      

  2.   


    不行是:没有反应,还是没有效果,还有有效果但是无中间过程?全局或成员变量
      bStop:boolean;mouseDown事件:
    var
      i:integer;
    begin
      bStop:=false;
      while not bStop do
      begin
        i:=i+1;
        label1.caption:=inttostr(i);
        application.processmessages;
      end;
    end;mouseUp事件:
    begin
      bStop:=true;
    end;
      

  3.   

    在Timer里面写上你的累加功能,当WM_LButtonDown=ture then timer1.enabled := ture;当WM_LButtonUp=true then timer1.enabled := false;