I'm creating a TPanel component at runtime with this code:
begin
MyPanel := TPanel.Create(Self);
MyPanel.Name := 'mypanel';
MyPanel.Position.X := 0;
MyPanel.Position.Y := 0;
MyPanel.Width := 100;
MyPanel.Height := 100;
Form2.Fill.Kind := TBrushkind.Solid;
form2.fill.Color := claSlateGrey;
MyPanel.Visible := True;
end;
but nothing is visible. All the main properties (size and position) should be enough, but it seems they're not. In other forms I'm creating a great number of components at runtime, that are working fine. I'm wondering what is it that makes this case different from the others. What I'm doing wrong?