在DElphi中的DataGrid怎样使它显示的行间隔改变颜色在DElphi中的DataGrid怎样使它显示的行间隔改变颜色?就向.NET中同名控件一样。
似乎是在OnDrawDataCell事件中写代码。 --------------------------------------------------------------- procedureTForm1.dbgridDrawColumnCell(Sender:TObject; constRect:TRect;DataCol:Integer;Column:TColumn; State:TGridDrawState); begin ifDBGrid2.DataSource.DataSet.RecNomod2=1then begin DBGrid2.Canvas.Font.Color:=clBlue; DBGrid2.Canvas.Brush.Color:=clyellow; end elsebegin DBGrid2.Canvas.Font.Color:=clred; DBGrid2.Canvas.Brush.Color:=clGradientActiveCaption; end; DBGrid2.DefaultDrawColumnCell(Rect,DataCol,Column,State); end; |
|