TComboBox动态创建

var

  ComboBoxList: Array [1..44] of TComboBox;

  I, J: Integer;

begin

  for I := 1 to row do
     begin
          for J := 1 to col do
          begin
            ComboBoxList[J] := TComboBox.Create(self);  //动态创建
            ComboBoxList[J].Parent := GroupBox1;  //或 ScrollBox1、 self     显示在啥组件上或Form上
            ComboBoxList[J].Width := 100;  //组件宽度
            if J = 1 then
              ComboBoxList[J].Left := 0    //组件左位置
            else
            ComboBoxList[J].Left := ComboBoxList[J-1].Left + 101;
          end;

     end;

end

 

posted @ 2012-10-15 20:11  邹晟  阅读(255)  评论(0编辑  收藏  举报