Autor Beitrag
Cash
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 40



BeitragVerfasst: So 02.03.03 18:16 
Hi@all

Ich hab ein kleines Problem. Ich möchte Zielscheibe programmieren, auf die man schießt. Jedoch sollte das Ziehlrohr immer dort zielen wo auch Die Maus derzeit sich befindet. Das Heißt:

Position des Zielrohrs = Position des Mauszeigers

Aus der Hilfe werde ich nicht ganz schlau.....kann mir einer von euch den nötigen Quelltext unten drunter posten?

danke an alle

CASH
torstenheinze
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 461



BeitragVerfasst: So 02.03.03 18:28 
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
image1.Left := x - image1.Width div 2;
image1.top := y - image1.Height div 2;
end;



ich suche noch mal nach einer besseren möglichkeit
torstenheinze
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 461



BeitragVerfasst: So 02.03.03 18:41 
ausblenden Quelltext
1:
2:
3:
4:
5:
procedure TForm1.Timer1Timer(Sender: TObject);
begin
image1.Left := mouse.CursorPos.x - form1.Left - image1.Width div 2 - 4;
image1.Top := mouse.CursorPos.y - form1.top - image1.Height div 2 - 23;
end;



die letzten werte in den codezeilen (-4 und - 23 müssen manuel angepasst werden, sie wariieren aufgund der höhe der titel-leiste)
torstenheinze
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 461



BeitragVerfasst: So 02.03.03 18:50 
du solltest bei der bitmap und bei allen unterliegenden objekten den cursor auf den wert -1 stellen, damit man den standard pfeil nicht sieht
Cash Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 40



BeitragVerfasst: So 02.03.03 18:56 
Ich danke dir. Probiere es sofort aus:)