--> DBGrid Delphi Tips and Tricks: Giving color to the current record in DBGrid | Delphi Tips Trick

For Newbie

Thursday 1 January 2015

DBGrid Delphi Tips and Tricks: Giving color to the current record in DBGrid

| Thursday 1 January 2015
I will share tips n tricks to customize DBGrid on borland delphi 7. in question is give customize colors on the active record in the DBGrid.



type
TCustomDBGridCracker = class(TCustomDBGrid);

procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumn;
State: TGridDrawState);
begin
with TCustomDBGridCracker(Sender) do
if DataLink.ActiveRecord = Row - 1 then
Canvas.Brush.Color := clRed
else
Canvas.Brush.Color := clWhite;
DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State);
end;

Related Posts