画Stringgrid斑马线
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;
本文来自博客园,作者:{咏南中间件},转载请注明原文链接:https://www.cnblogs.com/hnxxcxg/archive/2009/12/20/2940746.html