现在的位置: 首页 > 综合 > 正文

画Stringgrid斑马线

2011年08月03日 ⁄ 综合 ⁄ 共 546字 ⁄ 字号 评论关闭

procedure TformRule.StringGrid1DrawCell(Sender: TObject; ACol,
  ARow: Integer; Rect: TRect; State: TGridDrawState);
begin
  if (ARow = 0) or (ACol = 0) then
    exit;
  with sender as tstringgrid do     //斑马线效果
    with canvas do
    begin
      if (arow mod 2 = 0) then
      begin
        brush.Color:=clMoneyGreen;
        font.Color:=clblack;
        fillrect(rect);
        textout(rect.Left+2,rect.Top+2,cells[acol,arow]);
      end else begin
        brush.Color:=clWindow;
        font.Color:=clblack;
        fillrect(rect);
        textout(rect.Left+2,rect.Top+2,cells[acol,arow]);
      end;
    end;
end;

抱歉!评论已关闭.