Autor Beitrag
Phil511
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 27



BeitragVerfasst: So 11.02.07 20:44 
HI,
Was muss ich schreiben das ich die X und Y Koord. des Cursors bekomme?

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
procedure TForm5.Image1Click(Sender: TObject);
var x,y : Integer
begin
   x:= 'X Koord. des Cursors???';
   y:= 'y Koord. des Cursors???';
end;



mfg.Phil
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: So 11.02.07 20:51 
ausblenden Delphi-Quelltext
1:
ScreenToClient(Mouse.CursorPos).X;					

Das selbe für Y.

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
Phil511 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 27



BeitragVerfasst: So 11.02.07 20:53 
Thx
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: So 11.02.07 20:58 
Noch als Hinweis:
Mouse.CursorPos gibt die Koordinaten der Maus auf den Desktop bezogen aus. ScreenToClient() rechnet diese Koordinaten auf die Form um. Befindet sich die Form z.B. an Position 500, 100 und der Maus-Cursor an Position 600, 100 bezogen auf den Desktop, so gibt ScreenToClient() -> 100, 0 aus, weil sich die Maus 100 Pixel rechts vom Rand der Form befindet.

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
Nils:D
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 131

Debian, Win XP
Delphi 7 Arch.
BeitragVerfasst: Mo 12.02.07 09:34 
Generell solltest du dir allerdings diesen Codeaufbau merken:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
var p : TPoint;
begin
  CursorPos(p);
  ...p.X...
  ...p.Y...
lotus
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 19

XP MediaCenter
Delphi 2005 Personal
BeitragVerfasst: Mo 12.02.07 12:38 
Bei OnMouseDown oder OnMouseUp werden die Koordinaten acuh als Parameter übergeben!

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
procedure TForm2.FormMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin

end;

_________________
Das leben ist zu kostbar um es dem Schicksal zu überlassen! - Deus X Machina