行的如下:
procedure TForm1.StringGrid1DrawCell(Sender: TObject;
ACol, ARow: Integer;
Rect: TRect;
State: TGridDrawState);
begin
if (ACol <> 0) and (ARow <> 0 ) and (ARow mod 2 = 0) then
begin
StringGrid1.Canvas.Brush.Color := clAqua;
StringGrid1.Canvas.TextRect(Rect,Rect.Left + 1, Rect.Top + 2,StringGrid1.Cells[ACol,ARow]);
end;
end;
列的就如下:
procedure TForm1.StringGrid1DrawCell(Sender: TObject;
ACol, ARow: Integer;
Rect: TRect;
State: TGridDrawState);
begin
if (ACol <> 0) and (ARow <> 0 ) and (ACol mod 2 = 0) then
begin
StringGrid1.Canvas.Brush.Color := clAqua;
StringGrid1.Canvas.TextRect(Rect,Rect.Left + 1, Rect.Top + 2,StringGrid1.Cells[ACol,ARow]);
end;
end;