....
private
nValorAnt: Integer;
FColor, BColor: TColor;
public
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.DBGDatosDrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
if State = [] then
begin
if nValorAnt <> TblArticulosID_GRUPO.AsInteger then
begin
nValorAnt := TblArticulosID_GRUPO.AsInteger;
if BColor = clWhite then
begin
FColor := clWhite;
BColor := clGreen;
end
else
begin
FColor := clBlack;
BColor := clWhite;
end;
end;
TDBGrid(Sender).Canvas.Font.Color := FColor;
TDBGrid(Sender).Canvas.Brush.Color := BColor;
end
else
TDBGrid(Sender).Canvas.Font.Color := clWhite;
TDBGrid(Sender).DefaultDrawColumnCell(Rect, DataCol, Column, State);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
nValorAnt := 0;
FColor := clWhite;
BColor := clGreen;
end;
end.