Autor Beitrag
Daniel_100
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 63

Win XP
D3 Prof, D6 Enterprise
BeitragVerfasst: Sa 14.06.03 17:10 
Hallo!

Ein Bild soll (innerhalb einer Form) dem Mauszeiger folgen? Kann mir jemand den Code dafür geben?

Danke

Daniel
Tweafis
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 647

WinXP + fbsd
Delphi 5 Prof
BeitragVerfasst: Sa 14.06.03 17:14 
...
ausblenden Delphi-Quelltext
1:
2:
3:
4:
Form.OnMouseMove

Image1.x := X - Image1.Width div 2;
Image1.y := Y - Image1.Height div 2;


:roll:

_________________
.: Es wird der Tag kommen, an dem wir es nicht mehr ändern können :.
AndyB
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1173
Erhaltene Danke: 14


RAD Studio XE2
BeitragVerfasst: Sa 14.06.03 17:15 
Titel: Re: Mauszeiger folgen
Daniel_100 hat folgendes geschrieben:
Kann mir jemand den Code dafür geben?

Nein, da ich sowas noch nie programmiert habe.

Du kannst es aber mit einem Timer und den Eigenschaften von Mouse (Mouse.Pos.X, Mouse.Pos.Y) zusammenbasteln.

_________________
Ist Zeit wirklich Geld?
Daniel_100 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 63

Win XP
D3 Prof, D6 Enterprise
BeitragVerfasst: Sa 14.06.03 17:23 
Bei "Image.x" bzw. "Image1.y" spukt Delphi aber "undeclared identifier" aus. Was muss noch ergänzt werden? :?
AndyB
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1173
Erhaltene Danke: 14


RAD Studio XE2
BeitragVerfasst: Sa 14.06.03 17:24 
Left = x und Top = y

_________________
Ist Zeit wirklich Geld?
Tweafis
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 647

WinXP + fbsd
Delphi 5 Prof
BeitragVerfasst: Sa 14.06.03 17:25 
Ja, Image1.Left und Image1.Top

_________________
.: Es wird der Tag kommen, an dem wir es nicht mehr ändern können :.
Daniel_100 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 63

Win XP
D3 Prof, D6 Enterprise
BeitragVerfasst: Sa 14.06.03 17:27 
Achso, ist doch klar!

Danke Euch
Pascal
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 155

Win 98, Win XP
Delphi 2005, Delphi 5
BeitragVerfasst: Sa 14.06.03 17:28 
Titel: Re: Mauszeiger folgen
AndyB hat folgendes geschrieben:
Daniel_100 hat folgendes geschrieben:
Kann mir jemand den Code dafür geben?

Nein, da ich sowas noch nie programmiert habe.

Du kannst es aber mit einem Timer und den Eigenschaften von Mouse (Mouse.Pos.X, Mouse.Pos.Y) zusammenbasteln.
Ich glaube das heißt eher mouse.cursorpos.x/y
AndyB
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1173
Erhaltene Danke: 14


RAD Studio XE2
BeitragVerfasst: Sa 14.06.03 18:17 
Gut dass es die CodeInsight gibt.

_________________
Ist Zeit wirklich Geld?
Pascal
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 155

Win 98, Win XP
Delphi 2005, Delphi 5
BeitragVerfasst: Sa 14.06.03 20:56 
stimmt
G-McKree
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 178



BeitragVerfasst: Di 17.06.03 21:18 
wie wärs mit nem TTimer der nach ablauf das objekt in die richtung der maus bewegt?

musst ja nur die maus-koordinaten relativ zur form berechnen und dann das objekt abhängig vom verhältnis der koordinaten von maus und objekt verschieben
Pascal
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 155

Win 98, Win XP
Delphi 2005, Delphi 5
BeitragVerfasst: Mi 18.06.03 15:52 
Dafür müsste man aber auf jeden Fall noch wissen, wie hoch die Titelleiste ist.