如题

解决方案 »

  1.   

    for(int i=0;i<100;i++)
    {
    Button b=new Button();
    b.Name="";
    b.Text="";
    b.Point=....
    }
      

  2.   

        public partial class FormTest : Form
        {
            public FormTest()
            {
                InitializeComponent();
            }        private int i = 1;        private void CreateButton()
            {
                Button b = new Button();
                b.Name = "Button" + ++i;
                b.Location = new System.Drawing.Point(0, (i - 1) * 20);
                b.TabIndex = i;
                b.Visible = true;
                b.Click += new EventHandler(b_Click);
                this.Controls.Add(b);
            }        void b_Click(object sender, EventArgs e)
            {
            }        private void FormTest_Load(object sender, EventArgs e)
            {
                for (int i = 0; i < 5; i++)
                {
                    CreateButton();
                }
            }
       }
      

  3.   

    button也是一个对象,你跟新建对象一样的就可以新建按钮了。
      

  4.   

    web 版
    前台:
    <asp:Table ID="TableCondition" runat="server"> 
                                    </asp:Table> 
    后台:   protected void Page_Init(object sender, EventArgs e)
        {
            for (int i = 0; i < 5; i++)
            {
                AddNewRow(i);
            }    }    public void AddNewRow(int i)
        {
            TableRow trnew = new TableRow();
            TableCell tcnew = new TableCell();        Button btn = new Button();
            btn.ID = "btn" + i.ToString();
            btn.Click += new EventHandler(btn_Click);        tcnew.Controls.Add(tbox);
            trnew.Cells.Add(tcnew);
            this.TableCondition.Rows.Add(trnew);
        }
     
      

  5.   

    你一定要把循环生成的Button 加入到page 或其他容器控jian 里面
      

  6.   

    还要 有这样一行代码
     this.Controls.Add(button);

    很关键 ing ~
      

  7.   


    for(int i=0;i <100;i++) 

    Button b=new Button(); 
    b.Name=""; 
    b.Text=""; 
    b.Point=.... 
    }
      

  8.   

    Button x;
    int NUMS=20;
    for(int i=0;i<NUMS;i++)
    {
    x=new Button();
    this.controls.add(x);
    }
      

  9.   

    for(int i=0;i <100;i++)
    {
    Button b=new Button();
    b.Name="";
    b.Text=i.Tostring();
    This.Controls.add(b);
    }
      

  10.   

      记得动态创建的BUTTON用完了要销毁.. 创建多鸟,不销毁程序会报错地..
      

  11.   

    http://hi.baidu.com/cicosystem/space。去这里看看可能对你有用
      

  12.   

    http://hi.baidu.com/cicosystem/blog这里不错。