procedure TForm1.FormCreate(Sender: TObject); var i, j: Integer; begin for i := 1 to sg.RowCount - 1 do for j := 0 to sg.ColCount - 1 do sg.Cells[j, i] := IntToStr(i * j) end;procedure TForm1.sgDrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState); begin if ARow mod 2 = 0 then begin if ARow = 0 then Exit; sg.Canvas.Brush.Color := clLime; sg.Canvas.FillRect(Rect); sg.Canvas.TextOut(Rect.Left + 2, Rect.Top + 2, sg.Cells[ACol, ARow]) end; end;
var
i, j: Integer;
begin
for i := 1 to sg.RowCount - 1 do
for j := 0 to sg.ColCount - 1 do
sg.Cells[j, i] := IntToStr(i * j)
end;procedure TForm1.sgDrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
begin
if ARow mod 2 = 0 then
begin
if ARow = 0 then Exit;
sg.Canvas.Brush.Color := clLime;
sg.Canvas.FillRect(Rect);
sg.Canvas.TextOut(Rect.Left + 2, Rect.Top + 2, sg.Cells[ACol, ARow])
end;
end;