Hi,
In order for the OnDrawColumnCell event to fire, you need to set the DefaultDrawing property to False. Then you need to handle drawing the content of all the cells. Here is a simple example:
procedure TForm29.RzDBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn;
State: TGridDrawState);
begin
if Column.FieldName = 'AB' then
RzDBGrid1.Canvas.Brush.Color := clRed
else
RzDBGrid1.Canvas.Brush.Color := clYellow;
RzDBGrid1.DefaultDrawColumnCell( Rect, DataCol, Column, State );
end;
The code above results in every cell of the grid having a background of Yellow, except for the ‘AB’ column which has a background color of Red. The DefaultDrawColumnCell method is used to actually to the drawing.
Ray