problème création TImage et Tlabel dans GrouBox en dynamique
Bonjour,
J'ai écrit une procedure qui me créé dans la TabSheet 'Sheet' (variable string contenant son nom - TabSheet1 par exemple) un GroupBox, puis un TImage dans le groupebox en question et un TLabel dedans aussi.
Il me créé bien le GroupBox mais pas le Tlabel ni le TImage.
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
| procedure TForm1.ObjetCreate();
begin
//imcrémente Num
inc(Num);
with TGroupBox.Create(Form1.FindComponent(Sheet)) do
begin
Parent:= Form1.FindComponent(Sheet) as TWinControl;
Left:=3;
Top:=(Num-1)*25;
Height:=25;
Width:=618;
end;
//créé un image
with TImage.Create(Form1.FindComponent('GroupBox'+IntToStr(Num))) do
begin
Parent := Form1.FindComponent('GroupBox'+IntToStr(Num))as TWinControl;
Left:=3;
Top:=3;
Height:=17;
Width:=17;
OnClick := Click;
end;
//créé un label et le remplit
with TLabel.Create(Form1.FindComponent('GroupBox'+IntToStr(Num))) do
begin
Parent := Form1.FindComponent('GroupBox'+IntToStr(Num))as TWinControl;
Left:=34;
Top:=3;
Height:=17;
Width:=570;
Caption :=AnsiRightStr(Ligne, Length(Ligne)-1);
end;
end; |