你的问题问的很好,不过,这样的技术现在开发人员基本不在自己动手开发了,多数使用一些商业的或者免费的grid组件来完成了,不过,我还是花了2分钟的时间给你写了一个例子,使用的是delphi6标准的dbgrid组件.我用的是bde的table,连接的是dbdemos下的animams.dbf数据库,窗体上有一个dbgrid,在dbgird的ondrawdatacell事件,加入了如下的代码: procedure TForm1.DBGrid1DrawDataCell(Sender: TObject; const Rect: TRect; Field: TField; State: TGridDrawState); begin with (Sender as TDBGrid).Canvas do begin if Table1.FieldByName('size').asInteger >10 then begin Brush.Color := clRed; end else begin Brush.Color := clWhite; end; FillRect(Rect); if Field.DataType = ftTypedBinary then Exit; TextOut(Rect.Left,Rect.Top,Field.AsString); if gdSelected in State then begin Brush.Color := clBlue; FillRect(Rect); Font.Color := clWhite; TextOut(Rect.Left,Rect.Top,Field.AsString); end; if gdFocused in State then begin Brush.Color := clBlue; FillRect(Rect); Font.Color := clWhite; TextOut(Rect.Left,Rect.Top,Field.AsString); end end; end; 你看一看. 杨硕--delphi的忠实拥戴者 yangshuo@263.net
----------------------------------------------
delphi的忠实拥戴者 一起交流DELPHI MSN: tech@delphisoft.com.cn