在一个页面生成控件,我输入7个控件,让它一行五个,剩下的两个为一行怎么做?

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WFInfo.Info.Class
{
public class InfoClass
{

    public string InfoName { get; set; }  //页面名字
    public string ConType { get; set; }//控件类型
    public string ConValue { get; set; }//控件的默认值
    public int ConIndex { get; set; }//控件的索引
    public string ConDesc { get; set; }//控件描述
    public string CFName { get; set; }//控件名称
}

}

//在页面中添加控件
private void Contrl_Load(object sender, EventArgs e)
{
this.Name = ic.InfoName;
this.Text = ic.InfoName;
for (int i = 0; i < ic.ConIndex; i++)
{
Label lb = new Label();
lb.Visible = true;
lb.Text = ic.ConValue;
lb.Width = 50;
lb.Location = new Point(20 * i, 24);
panel1.Controls.Add(lb);

            TextBox tb = new TextBox();
            tb.Visible = true;
            tb.Text = ic.ConValue;
            tb.Name = ic.CFName;
            tb.Width = 100;
            tb.Location = new Point(20 * i + tb.Width * i, 24);
            panel1.Controls.Add(tb);
        }
    }

图片说明

小弟只能把它弄成一行五行,剩下的两个为一行,求哪位大神帮帮忙,感谢!!!

再套一层 循环,最大索引值 4.

用tablelayoutpanel控件,自带表格排列功能。