프로그래밍 노트

[델파이] 동적배열 선언 본문

델파이

[델파이] 동적배열 선언

떡잎 2010. 1. 18. 11:13

procedure TForm1.Button1Click(Sender: TObject);
var
  i, j : integer;
begin
  SetLength(bbb, 3, 2);
  for i := low(bbb) to high(bbb) do
  begin
    for j := low(bbb[i]) to High(bbb[i]) do
    begin
      bbb[i,j] := TButton.Create(nil);
      bbb[i,j].parent := self;
      bbb[i,j].Width := 10;
      bbb[i,j].Height := 20;
      bbb[i,j].Top := 30 * i;
      bbb[i,j].Left := 20 * j + bbb[i,j].Width;
    end;
  end;

  for i := low(bbb) to high(bbb) do
  begin
    for j := low(bbb[i]) to High(bbb[i]) do
    begin
      bbb[i,J].Destroy;
    end;
  end;
end;

Comments