Search code examples
delphicolorsthemesvcl

Custom background color in Delphi with runtime themes enabled


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.


Solution

  • Remove seClient from StyleElements and set ParentBackground to false.

    aPanel.StyleElements :=  Panel1.StyleElements - [seClient];
    aPanel.ParentBackground := False;
    aPanel.Color := clLime;