9

I'm creating a bunch of Panels on runtime and I want to change their color. Color property doesn't work and I don't want turn of runtime themes.

I'm using Delphi XE3.

Cœur
  • 37,241
  • 25
  • 195
  • 267
David Novák
  • 103
  • 4
  • Make sure that `ParentColor` is disabled – jpfollenius Jun 06 '13 at 14:23
  • 2
    When you say themes , do you mean Windows Native Themes or Vcl Styles? if you are using Vcl Styles you can try this question http://stackoverflow.com/questions/10309190/how-i-can-change-the-color-of-a-tpanel-with-the-vcl-styles-enabled or remove the `seClient` value from the `StyleElements` property. – RRUZ Jun 06 '13 at 14:28

1 Answers1

9

Remove seClient from StyleElements and set ParentBackground to false.

aPanel.StyleElements :=  Panel1.StyleElements - [seClient];
aPanel.ParentBackground := False;
aPanel.Color := clLime;
bummi
  • 27,123
  • 14
  • 62
  • 101