Ich bins nochmal!!
Nun hab ich mir zwar Beispiele zu FindComponent angeschaut, weiß jedoch nicht wie ich dies in den gewünschten Befehl umsetzen könnte.
Nochmal die Frage:
Was ist bei meinem Quellcode richtig/ was ist falsch, wenn ich ein shape habe auf dem ein image sich befindet
1. dieses sich (- mache ich dann bei onMouse.dblClick - ) auf die Position des "neuen
Shapes" verschiebt (nicht pixelweise)
-> das neue Shape soll berechnet werden, indem im Namen (??? oder anderst???) (oder die
Tagnummmer) die Zahl des Shapes mit der gewürfelten zahl addiert wird.
2. die neue Position des Images ist dann der neue Name (die neue Tagnummer??) des Shapes
Ich habe 10 Shapes und 1 Image:
die Position wird hier im Beispeil nur bei einer 1 berechnet( kann ich da auch wieder eine Schleife machen? :
for 1 to 6 do ...
Delphi-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18:
| for i:=1 to 10 do if Zahl = 1 then begin <span style="color: red"> if Image1.top = (FindComponent('Shape' + IntToStr(i)) as TShape).top and if Image1.left = (FindComponent('Shape' + IntToStr(i)) as TShape).left then begin <span style="color: red"> (FindComponent('Shape' + IntToStr(i)) as TShape).top :=(FindComponent('Shape' + IntToStr(i)+IntToStr(Zahl)) as TShape).top; (FindComponent('Shape' + IntToStr(i)) as TShape).left := (FindComponent('Shape' + IntToStr(i)+IntToStr(Zahl)) as TShape).left; <span style="color: red"> image1.top := (FindComponent('Shape' + IntToStr(i)) as TShape).top-20; image1.left := (FindComponent('Shape' + IntToStr(i)) as TShape).left+5; |
Vielen Dank im Voraus!
mfg Chris