TDBGrid 隔行颜色

with(Sender as TDBGrid) do
      begin
          if ((State=[gdSelected])or (State= [gdSelected, gdFocused])) then
          begin
              Canvas.Font.Color:=clHighlightText;
              Canvas.Brush.Color:=clHighlight;
          end
          else
          begin
              if   DataSource.DataSet.RecNo  mod  10 =0   then
                  Canvas.brush.Color:=clRed  ;
             //else
                // Canvas.brush.Color:=clYellow;
          end;
          DefaultDrawColumnCell(Rect,DataCol,Column,State);   //这行是关键
      end;

posted on 2011-11-12 16:25  舟山牙医  阅读(207)  评论(0编辑  收藏  举报

导航