当前位置:主页>销售管理软件> 列表

請問滑鼠按下時如何讓mousedown訊息一直觸發? 找计算机管理软件

记账软件版1楼: 請問滑鼠按下時如何讓mousedown訊息一直觸發?
如下程序,不管按下多久,i都不會增加,要讓i一直增加怎麼辦呢?
procedure TForm1.Image1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
i:=i+1;
caption:=inttostr(i);
end;

2楼: 我这个怎么可以的呢
var
Form1: TForm1;
i:integer;

implementation

{$R *.dfm}


procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
i:=i+1;
button1.Caption:=inttostr(i);
end; 如计算机管理软件

3楼: 只能加一吧 如果要再加一的話要再按一下

4楼: 对啊
加上这一局试试
FormMouseDown(Sender,Button,Shift,x,y);

5楼: 用TIMER控件,如果按下就用TIMER再次发MouseDown

6楼: 如果想停的话,就加一个判断条件~~!!

记账软件版7楼: sbzldlb的方法無效
boy2002cn我在看以前的MOUSEDOWN問題常有人提

8楼: 我的方法无效啊???你试试


我可是当场在delphi上写的代码,调试过的
var
Form1: TForm1;
i:integer;
Stop:Boolean;

implementation

{$R *.dfm}


procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
i:=i+1;
button1.Caption:=inttostr(i);
if not Stop then
FormMouseDown(Sender,Button,Shift,x,y);
end;

9楼: var
Form1: TForm1;
i:integer;
j:boolean;
implementation

{$R *.dfm}

procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
j:=true;
while j do
begin
inc(i);
application.ProcessMessages ;
form1.Caption:=inttostr(i);
end;
end;

procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
j:=false;
end;

10楼: 感謝kgm