Hi,
I have a problem in coloring of a DBGrid.
I can set with the following code the font color but the background of the cells isn't changed.
v_color is set on Form.Show to an initial state of clBlack.
procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
v_buffer_new:=ZQuery1.FieldByName('md_row_date').AsString;
if ZQuery1.Active then
begin
if v_buffer_new=v_buffer_old then
begin
DBGrid1.Canvas.Font.Color:=v_color;
DBGrid1.Canvas.Brush.Color:=clSilver;
DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State);
end
else
begin
if v_color=clBlack then v_color:=clBlue
else v_color:=clBlack;
DBGrid1.Canvas.Font.Color:=v_color;
DBGrid1.Canvas.Brush.Color:=clBlack;
DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State);
v_buffer_old:=v_buffer_new;
end;
end;
end;
The complete thing is running under Lazarus 0.9.22 with FP 2.0.4 on Debian Linux with GTK1.
Has somebody an idea why only the font is changed?
Help appreciated.
Regards,
Tibor