Hallo Leute,
ich möchte TShapes zur Laufzeit erstellen. Dazu lasse ich zuerst das Parent suchen, auf dem das Shape erstellt werden soll (es handelt sich um ein Panel).
Mit automatischer Labelerstellung geht das. Ich habe mal den Quelltext gepostet. Mit dem geht es definitiv
nicht. Ich bekomme allerdings auch keine Fehlermeldung.
Woran liegt's????
Delphi-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21:
| var myshape : TShape; begin for j := 1 to 5 do begin myshape := TShape.Create(TPanel(PanelComponent)); with myshape do begin parent := TPanel(PanelComponent); name := 'Shape_'+inttostr(j); shape := stRectangle; height := 10; width := TPanel(PanelComponent).Width; top := round(TPanel(PanelComponent).height); left := 0; brush.Color := clblack; brush.Style := bssolid; pen.Style := pssolid; pen.Color := clred; visible := true; end; end; end; end; |
Schon einmal vielen Dank,
Björn
Meine Programme bestehen aus 90 % Nachforschung und 10 % Programmierarbeit. Ich hoffe das ändert sich eines Tages...