interfaceuses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls, Menus;type
  TForm1 = class(TForm)
    MainMenu1: TMainMenu;
    N1: TMenuItem;
    N2: TMenuItem;
    N3: TMenuItem;
    N4: TMenuItem;
    procedure N1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;var
  Form1: TForm1;
  ledit_name:array[1..200] of TLabeledEdit; //名称
  //ledit_left:array[1..200] of TLabeledEdit;//左边坐标
  //ledit_right:array[1..200] of TLabeledEdit;//右边坐标
  i:integer=0;
implementation{$R *.dfm}procedure TForm1.N1Click(Sender: TObject);
var l:integer;
begin
  if i=200 then
    exit;
  i:=i+1;  
  l:=30;  //左边
  ledit_name[i]:=TLabeledEdit.Create(nil);  //生成控件LabeledEdit
  with ledit_name[i] do  //设置控件
  begin
    LabelPosition:=lpLeft; //设置LABEL在左边
    EditLabel.Caption:=inputbox('请输入','元素名称','');
      if i=1 then
      begin
        Top:=10;
        Left:=l;
      end else begin //设置LabeledEdit控件的位置
        Top:=(10+Width)*i;
        Left:=l;
      end;
  end;
end; 
//没有任务错误提示就是想点一下菜单生成一个 LabeledEdit控件 放在上一个的下面间隔10含像素点

解决方案 »

  1.   

    LZ 是想说这代码没显示创建的控件么?
    1 创建控件没指定parent
    2 如果1没起作用尝试设定控件宽高和visible属性
    3 如果以上都没起作用,把控件bringtofront
    另外记得释放数组
      

  2.   

    另外补充下,高应该是(10+height)*i;吧
      

  3.   

    控件要指定parent才能显示
    要得到上一个控件的top位置,才能在它的下方10个像素放新控件
      

  4.   

    创建可视化组件首先就要设置 Parent 属性.
      

  5.   

    是 parent
    。。写这东西的时候一直想不起来。
    那个高度也弄成了宽度了。OH。--!