Page 1 of 1

CrDBGrid row color

Posted: Thu 19 Jan 2006 07:59
by hotdog
Is it possible to add these options to the CrDBgrid:
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;
btw I have read this topic:
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

Posted: Thu 19 Jan 2006 15:19
by Ikar
We don't have plans to add such properties to the CrDBGrid. But you can create your own component inherited from the CrDBGrid to add any properties you want and override any events you need.

Posted: Thu 19 Jan 2006 21:09
by hotdog
Thanks for the reply.

I understand that you don't plan to add new features to the crdbgrid, but what about fixing any potential bugs? I'm a bit worried because I started using this component and I have some miror issues/bugs to report.

Posted: Fri 20 Jan 2006 15:03
by Ikar
If you know about any critical errors in the CrDBGrid, send us descriptions of these errors and we will fix them