Delphi 2009 - create a TPanel at runtime and change its color
When you want to have colored panels under a themed OS you have to set ParentBackground to False.
Try this :-)
procedure TForm1.Button1Click(Sender: TObject);
var
pnlTest : TPanel;
begin
pnlTest := TPanel.Create(Form1);
pnlTest.Parent := Form1;
pnlTest.Width := 100;
pnlTest.Height := 100;
pnlTest.ParentBackground := false;
pnlTest.Color := clRed;
end;