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:
| private Shapes: array of TShape; public Madn: TMadn; procedure OnShapeClick(Sender: TObject); end;
var Form2: TForm2; count,anz,z: byte;
procedure TForm2.CreateShapes(n: word; wc: TWinControl); begin SetLength(Shapes, n); Field.Parent := Panel1; while n > 0 do begin Shapes[n] := TShape.Create(Self); Shapes[n].Parent := wc; case n of 1,2,3,4: Shapes[n].Brush.Color := rgb(255,0,0); 5,6,7,8: Shapes[n].Brush.Color := RGB(255,216,0); 9,10,11,12: Shapes[n].Brush.Color := RGB(58,196,0); 13,14,15,16: Shapes[n].Brush.Color := RGB(0,148,255); end; Shapes[n].Shape := stcircle; Shapes[n].Height := 30; Shapes[n].Width := 30; Shapes[n].Left := UMadn.Start[n].X; Shapes[n].Top := UMadn.Start[n].Y; Shapes[n].Pen.Width := 3; Shapes[n].Visible := true; Shapes[n].Enabled := false; n := n-1; OnClick := Self.OnShapeClick(Self); end; end;
procedure TForm2.OnShapeClick(Sender: TObject); begin showmessage('Läuft'); end; |