日期:2014-05-18  浏览次数:20970 次

C#Form启动时候加载50个Textbox,并且分成5行显示,即每行10个Textbox
怎么实现啊,要求用循环语句写,要是用手拖的话就不麻烦大家了

------解决方案--------------------
C# code
 private void Form1_Load(object sender, EventArgs e)
        {
            for (int i = 0; i < 50; i++)
            {
                TextBox txtBox = new TextBox();
                txtBox.Name = "TextBox" + i.ToString();
                txtBox.Width = 50;
                txtBox.Location = new Point(100+(i%5)*50,100+(i/5)*30);
                this.Controls.Add(txtBox);
            }
        }