[Reported to bugtracker] TDBGrid Column Titles problem and OnDrawColumn event lazarus / 31-LCL ---------------------------------------------------------------------- halmariane · 2013-03-13 09:16 Hi: I'm using Lazarus 1.1 with fpc 2.7.1. There is one problem with TDBGrid component and the column titles customization. If I customize the columns of the TDBGrid then this customization has no effect if I set to true False the property DefaultDrawing of TDBGrid parent component. Very complicate my explanation? In reverse order, if the DefaulDrawing property of TDBGrid is configured to True False then the Column titles properties have no effect. There is no that problem with TStringGrid, only with TDBGrid. Regards ----- Reported http://bugs.freepascal.org/view.php?id=24039 ---------------------------------------------------------------------- halmariane · 2013-03-13 09:44 Quote from: halmariane on March 13, 2013, 10:16:10 amHi: I'm using Lazarus 1.1 with fpc 2.7.1. There is one problem with TDBGrid component and the column titles customization. If I customize the columns of the TDBGrid then this customization has no effect if I set to true False the property DefaultDrawing of TDBGrid parent component. Very complicate my explanation? In reverse order, if the DefaultDrawing property of TDBGrid is configured to True False then the Column titles properties have no effect. There is no that problem with TStringGrid, only with TDBGrid. Regards Sorry, there is a mistake, the problem is when DefaultDrawing is configured to False Reported http://bugs.freepascal.org/view.php?id=24039 ---------------------------------------------------------------------- halmariane · 2013-03-13 13:34 I follow reporting issues regarding TDBGrid. Somebody knows about this other issue?? OnDrawColumnCell event After set DefaultDrawing=False...... this code works in any Delphi version but does not work with Lazarus in Debian. Code: [Select]procedure TMyForm.DBGrid1DrawColumnCell(Sender: TObject;   const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState); begin    if SomeConditionIsTrue then      DBGrid1.Canvas.Brush.Color:=clGray       else        DBGrid1.Canvas.Brush.Color:=clWindow;   DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State); end; Now ??.............  I have solved adding one aditional line of code: Code: [Select]procedure TMyForm.DBGrid1DrawColumnCell(Sender: TObject;   const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState); begin    if SomeConditionIsTrue then      DBGrid1.Canvas.Brush.Color:=clGray       else        DBGrid1.Canvas.Brush.Color:=clWindow;   // *************** NEW LINE NEEDED ********************   DBGrid1.Canvas.FillRect(Rect);   // ***********************************   DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State); end;   Not all but almost all portable Reported http://bugs.freepascal.org/view.php?id=24040