How can I change brush color in DBGrid? lazarus / 31-LCL ---------------------------------------------------------------------- Milsa · 2016-05-07 15:48 This is my code from Delphi in DBGridDrawColumnCell (it works): Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i (Sender as TDBGrid).Canvas.Brush.Color := clGray;But in Lazarus doesn't works. ---------------------------------------------------------------------- wp · 2016-05-07 17:33 The event for changing canvas properties in descendants of TCustomGrid is OnPrepareCanvas: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.DBGrid1PrepareCanvas(sender: TObject; DataCol: Integer;  Column: TColumn; AState: TGridDrawState);begin  if odd(TDBGrid(Sender).DataSource.Dataset.RecNo) then    // NOTE: RecNo is not available for all dataset types!    TDBGrid(Sender).Canvas.Brush.Color := clSilver;  if DataCol = 0 then // or: if Column.Index = 0 then    TDBGrid(Sender).Canvas.Font.Style := [fsBold];end;