在DBGrid的OnDrawDataCell事件中写如下代码:if DataSet.AsInteger < 5 then
with DBGrid.Canvas do
begin
Brush.Color := clRed;
DBGrid.DefaultDrawDataCell(Rect, Field, State);
end;
with DBGrid.Canvas do
begin
Brush.Color := clRed;
DBGrid.DefaultDrawDataCell(Rect, Field, State);
end;
我是想在浏览数据的FORM一打开,就根据数据来改变某些行的颜色,表示这几行的数据
已经超过警戒线.应该怎么做呢?
if DataSet.AsInteger < 5 then
Brush.Color := clRed;
DBGrid.DefaultDrawDataCell(Rect, Field, State);
end;
在DBGrid1的OnDrawDataCell事件中写如下代码:
if Table1.FieldByName("f1").AsInteger<5 then
begin
DBGrid1.Canvas.Font.Color:=clAqua;
DBGrid1.Canvas.Brush.Color:=clBlack;
end;
DBGrid1.DefaultDrawColumnCell(Rect,DataCol,Column,State);