Autor Beitrag
Arzh-duard
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 20

Win XP
D7 Prof
BeitragVerfasst: Fr 18.02.05 19:04 
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????

ausblenden 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...
OneOfTen
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Fr 18.02.05 20:32 
ausblenden Delphi-Quelltext
1:
top := round(TPanel(PanelComponent).height);					


ich denke, weil du die TShape.Top Eigenschaft auf die Panelhöhe setzt? Dann fängt die Komponente erst da an, wo das Panel aufhört und deshalb siehst dus nicht