要像VB那样由编译器支持的话就不行,可以这样:
A: array [0..10] of TLabel;for i := 0 to 10 do
  A[i] := TLabel.Create(Form1);
  A[i].Parent := Form1;
end;

解决方案 »

  1.   

    a:tcomponent;
     a:=findcomponent('label'+inttostr(i));
     if assigned(a) then
     Tlabel(a).caption:='label'+inttostr(i);
      

  2.   

    var mylabel: array[1..100] of Tlabel;
        i:integer=1;
    begin
        while i<=100 do
    begin
       mylabel[i]:=Tlabel.create(self);
       mylabel[i].parent:=form1;
       mylabel[i].caption:='kk+inttostr(i)';
       mylabel[i].onclick:=myclick;
          inc(i);
    end;   
    end;
      

  3.   

    mudeen(笑哥哥) 是对的,我觉得好象只能这么调用
      

  4.   

    看看行不行,我没试
    var A: array [0..10] of TLabel;
    begin
      a[0]:=label1;
      a[1]:=label2;
        .
        .
        .
      a[10]:=label10;
    end;
    以后用a就可以了
      

  5.   

    我说的不是组数组赋值,而是给label数组赋值
      

  6.   

    在TformMain(假设)的声明中:
    public
      Labels1:Array of TLabel;在TformMain.FormCreate(OnCreate事件)中:
    begin
      ……
      SetLength(Labels1,LabelNum);
      for i := 0 to LabelNum-1 do
      begin
        Labels1[i] := TLabels.Create(self);
        InsertControl(Labels1[i]);
        Labels1[i].Visible:=true;
        Labels1[i].X=……
        Labels1[i].Y=……
        Labels1[i].Caption=……
        ……
      end;
    ……
    end;
    在Delphi中不能象VB那样在设计时把一组控件作为一个数组放到Form上,只能编写代码在运行时生成。
    你应该详细说明你要作什么,一般来说Label数组用处不大,在VB中控件数组主要用于多个控件使用相同的事件代码,在Delphi中只要把它们的事件设为相同的函数就行了。