TCrDBgrid.RowColorWhenActive
TCrDBgrid.RowColorWhenInactive
This would replace a big amount of code on the CRDBGrid.OnDrawColumnCell event if someone likes to customize it.
sample code:
Code: Select all
begin
if (ActiveControl = CrDBGrid1) then
begin
if (gdSelected in State) then
begin
CrDBGrid1.Canvas.Brush.Color := clRed;
CRDBGrid1.Canvas.Font.Color := clWhite;
end
else
begin
CrDBGrid1.Canvas.Brush.Color := clWindow;
CRDBGrid1.Canvas.Font.Color := clBlack;
end;
CrDBGrid1.DefaultDrawColumnCell(Rect,DataCol,Column,State);
end
else { ActiveControl CrDBGrid1 }
begin
if (gdSelected in State) then
begin
CrDBGrid1.Canvas.Brush.Color := clBlue;
CRDBGrid1.Canvas.Font.Color := clWhite;
end
else
begin
CrDBGrid1.Canvas.Brush.Color := clWindow;
CRDBGrid1.Canvas.Font.Color := clBlack;
end;
CrDBGrid1.DefaultDrawColumnCell(Rect,DataCol,Column,State);
end;
end;
http://crlab.com/forums/viewtopic.php?t=2629
and I believe the options for setting the rows color would be very convenient.
thanks,
Christos Michalislis