I have a frame, with color clSkyBlue, which sits in an application with panels and various things with the color clSkyBlue. The program uses TStyleManager this sets the color to the current style. (ie windows10,windows10 dark etc). The problem is that everything has the correct color set from the stylemanager except for the frame which remains clSkyBlue.
How do I force the frame to follow the current style selected?
//in the main form code
void __fastcall TMainFormUnit::FormCreate(TObject *Sender)
{
...
for (int i = 0; i < TStyleManager::StyleNames.Length; i++)
cbxVclStyles->Items->Add(TStyleManager::StyleNames[i]);
TStyleManager::TrySetStyle(TStyleManager::StyleNames[1]);
...
}
//---------------------------------------------------------------------------
void __fastcall TMainFormUnit::cbxVclStylesChange(TObject *Sender)
{
TStyleManager::SetStyle(cbxVclStyles->Text);
}
If you need your
TFrameto change appearance as the parent component changes, set its properties accordingly:This will also set its
Colorback toclBtnFace.I also recommend not using the
FormCreateevent in C++. Use the constructor: