unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Grids;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    Button4: TButton;
    StringGrid1: TStringGrid;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    procedure Button4Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

//dodaj wiersz
procedure TForm1.Button1Click(Sender: TObject);
begin
 Stringgrid1.Rowcount:=Stringgrid1.Rowcount+1;
end;

//dodaj kolumnê
procedure TForm1.Button2Click(Sender: TObject);
begin
 Stringgrid1.ColCount:=Stringgrid1.ColCount+1;
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
  with StringGrid1 do
  if  RowCount>VisibleRowCount  then  TopRow:=RowCount-VisibleRowCount;
end;

procedure TForm1.Button4Click(Sender: TObject);
var
  I, J : Integer;
begin
  with StringGrid1 do
    for I := 0 to ColCount - 1 do
      for J:= 0 to RowCount - 1 do
          Cells[I,J] := IntToStr(Random(141));
end;

end.
