[ solved ] Dbgrid active cell different color lazarus / 16-Databases ---------------------------------------------------------------------- John Landmesser · 2017-09-21 14:03 how to use  DrawColumnCell to just draw active cell in different color? must be really simple!! This code paints the whole active Column but active Cell only? 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    if DBGrid.SelectedField.Index = DataCol       begin         TDBGrid(Sender).Canvas.Brush.Color := clblue;        TDBGrid(Sender).Canvas.Font.Style := Font.Style + [fsBold];        TDBGrid(Sender).Canvas.Font.Color := clRed;       end; now searching here: https://forums.embarcadero.com/thread.jspa?threadID=253161&tstart=0 ---------------------------------------------------------------------- wp · 2017-09-21 14:17 Don't use OnDrawColumnCell, you'd have to draw everything by yourself. Application of the OnPrepareCell event is much simpler: it is called immediately before the cell is painted, all canvas properties already have been set, but in this event you can override them; a set of parameters comes with the event to decide which cell is painted. 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 ([gdSelected, gdFocused] * AState <> []) and (DBGrid1.SelectedColumn = Column) then begin    DBGrid1.Canvas.Brush.Color := clRed;    DBGrid1.Canvas.Font.Color := clWhite;  end;end; ---------------------------------------------------------------------- John Landmesser · 2017-09-21 17:25 thats's it, works perfect, thanks wp :-)