procedure TForm6.DBGrid1DrawDataCell(Sender: TObject; const Rect: TRect; Field: TField; State: TGridDrawState);var grid:TDBGrid; sName,sValue :String;begin grid:= (Sender as TDBGrid); sName := Field.DisplayName; if varIsNull(Field.Value) Then exit; sValue := Field.Value ; if (sName = 'S1') and (sValue = Edit1.Text) Then with grid.Canvas do begin brush.Color:=clYellow; FillRect(Rect); Font.Color := clRed; TextOut(rect.Left+2 ,Rect.Top+2, sValue); end;end;==================================OnDrawDataCell事件如上代码,试过全掉 if (sName = 'S1') and (sValue = Edit1.Text) Then 这句,还是没有改变单元格背景颜色.