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;

你可能感兴趣的:(grid)