Why Column->Title->Color fails
In modern Windows, the TDBGrid uses the operating system's "Themes" to draw headers. When themes are active, Windows takes over the painting of the button-like headers, ignoring the Color property entirely.
To fix this specifically for the Title:
DBGrid1->DrawingStyle = gdsClassic , not gdsThemedDBGrid1->FixedColor = clBtnFace; (this affects all headers).OnDrawTitleCell event and manually paint the background using DBGrid1->Canvas->FillRect(Rect).
void __fastcall TForm1::DBGrid1DrawColumnCell(TObject *Sender, const TRect &Rect,
int DataCol, TColumn *Column, TGridDrawState State)
{
/* if (DBGrid1->Columns->Items[DataCol]->FieldName == "Host")
{
// int size = wcslen(DBGrid1->Columns->Items[DataCol]->FieldName.c_str()+1);
DBGrid1->Columns->Items[DataCol]->Width = 100;
// DBGrid1->Columns->Items[DataCol]->Title->Font->Color = (TColor)clBlue;
DBGrid1->Columns->Items[DataCol]->Title->Color = (TColor)clGreen;//clBtnFace;
}
*/
if ( DataCol < 2 )
{
DBGrid1->Columns->Items[DataCol]->Title->Font->Color = (TColor)clBlue;
DBGrid1->Columns->Items[DataCol]->Title->Color = (TColor)clGreen;
// DBGrid1->Columns->Items[DataCol]->Width = 100;
}
}