在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; |
|