Hallo,
ich fange deshalb ein neues Thema an, da es nicht mehr um die Erstellung dynamischer Shapes geht, sondern um deren direkte verarbeitung:
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
procedure TForm1.Timer1Timer(Sender: TObject);
begin
  if (slepos <= shape1.left+shape1.width) then
  begin
    MyTShape:=TShape.Create(Self);
    MyTShape.Parent:=Form1;
    MyTShape.Show;
    MyTShape.height:=sheight;
    MyTShape.width:=swidth;
    MyTShape.top:=stppos;
    MyTShape.left:=slepos;
    MyTShape.Name:='Shape'+inttostr(j);
    MyTTimer:=TTimer.Create(Self);
    MyTTimer.tag:=j;
    MyTTimer.Interval:=1;
    MyTTimer.OnTimer := TimerProc;
    slepos:=slepos+periode;
    j:=j+1;
  end
  else begin end;
end;
 
procedure TForm1.TimerProc(Sender: TObject);
var
  Comp : TComponent;
  Name : string;
  Shape : TShape;
  Nummer : integer;
begin
  Nummer := (Sender as TTimer).Tag;
  Name := 'Shape' + IntToStr(Nummer);
  Comp := FindComponent(Name);
  Shape := TShape(Comp);
 
  edit1.text:=inttostr(shape.top);
 
  if (untenshape=false) AND (rechtsshape=false) then
  begin
    Shape.top:=Shape.top-5;
  end;
 
 if (untenshape=true) AND (rechtsshape=false) then
  begin
     Shape.top:=Shape.top+5;
  end;
 
 if (Shape.top+Shape.height)>=(shape1.top+shape1.height) then
  begin
   untenshape:=true;
  end;
 
 if (Shape.top)<=(shape1.top) then
  begin
   untenshape:=false;
  end;
 
  if (Shape.left+Shape.width)>=(shape1.left+shape1.width) then
  begin
   rechtsshape:=true;
  end;
end;
Die erzeugte Shapes schießen immer weit über die top des Shapes1 hinaus, anstatt "umzudrehen" hat jemand eine Idee?
MfG Blck