Autor Beitrag
Hasche
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 43



BeitragVerfasst: Do 10.01.08 12:54 
Bei einem Klick auf ein Bild soll dort ein Punkt (shape) erstellt werden.
Wie kann das programmiert werden?

Danksh :)


Moderiert von user profile iconGausi: Topic aus Delphi Language (Object-Pascal) / CLX verschoben am Do 10.01.2008 um 12:59
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Do 10.01.08 12:58 
Das würde ich im OnMouseDown des Formulars machen, z.B. so:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
var aShape: TShape;
begin
  aShape := TShape.Create(Self);
  aShape.Parent := self;
  aShape.Width := 20;
  aShape.Height := 20;
  aShape.Shape := stCircle;
  aShape.Top := y-10;
  aShape.Left := x-10;
end;

_________________
We are, we were and will not be.
Hasche Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 43



BeitragVerfasst: Do 10.01.08 13:17 
Das funktioniert bei mir leider nicht, da immer wenn ich mit der maus klick, zwar ein Puntk erscheint jedoch extrem nach Nord-Ost verschoben.

EDIT:
mit
aShape.Top := y+93;
aShape.Left := x-186;
klappts, danke :)
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Do 10.01.08 15:25 
Das liegt dann aber wahrscheinlich daran, dass du das OnMouseDown-Event eines Panels oder so verwendest. Dann sollte man evtl. den Parent nicht auf self, sondern eben auf dieses Dingens setzen.

_________________
We are, we were and will not be.