delphi StringGrid背景色隔行显示

procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
  Rect: TRect; State: TGridDrawState);
begin
      if   (ARow mod 2=1)  then
      begin
          StringGrid1.Canvas.Font.Color   :=   clred;
          StringGrid1.Canvas.Brush.Color :=$00FFF0F5;
          StringGrid1.Canvas.TextRect(rect,rect.Left,rect.Top,StringGrid1.Cells[acol, arow]);
          StringGrid1.Canvas.FrameRect(Rect);
      end;
end;

posted @ 2009-02-03 10:45  骑着骆驼逛沙漠  阅读(321)  评论(0编辑  收藏  举报