Entwickler-Ecke

Sonstiges (Delphi) - mausposition


diego - Mi 09.10.02 13:58
Titel: mausposition
hi,

wie kann ich mir die aktuelle mausposition anzeigen lassen. also so das immer irgendwo die x/y werte der position stehen???

mfg diego


a.C.k - Mi 09.10.02 14:12

Versuche es mal mit "Mouse.CursorPos.X" und "Mouse.CursorPos.Y"


diego - Mi 09.10.02 14:25

ok danke das klappt mal.

hab nun folgenden code:


Quelltext
1:
2:
3:
4:
5:
6:
7:
a:=Mouse.CursorPos.X;
b:=InttoStr(a);
edit1.text:=b;

c:=Mouse.CursorPos.Y;
d:=IntToStr(c);
edit2.text:=d;



wie kann ich das nun hinbiegen das sich das ständig aktualisiert??? also wenn ich die maus bewege das sie die zahlen ändern???[/code]


Christian S. - Mi 09.10.02 14:46

Hi!

Wenn Du das ganze ins OnMouseMove-Event der Form packst, geht's ganz einfach:


Quelltext
1:
2:
  edit1.Caption:=IntToStr(Mouse.CursorPos.x);
  edit2.Caption:=IntToStr(Mouse.CursorPos.Y);



MfG,
Peter

P.S.: Die Paramter X,Y von OnMouseMove geben Dir die Position innerhalb der Form!


diego - Mi 09.10.02 15:04

danke