dbgrid中根据任一条件某一格变色
procedure TForm_main.DBGridEh1DrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumnEh;
State: TGridDrawState);
begin
if (trim(DataModule1.ADOQuery1.FieldByName('dczt').AsString)='OK') then
begin
if datacol=6 then
begin
DbGrideh1.Canvas.Brush.Color:=clGradientActiveCaption;
DbGrideh1.DefaultDrawColumnCell(Rect,datacol,column,state);
end;
end;
end;
const Rect: TRect; DataCol: Integer; Column: TColumnEh;
State: TGridDrawState);
begin
if (trim(DataModule1.ADOQuery1.FieldByName('dczt').AsString)='OK') then
begin
if datacol=6 then
begin
DbGrideh1.Canvas.Brush.Color:=clGradientActiveCaption;
DbGrideh1.DefaultDrawColumnCell(Rect,datacol,column,state);
end;
end;
end;