我正在尝试从文本文件中提取的数据中在winform中的面板中动态添加多个单选按钮。但是当我加载应用程序时,面板中只显示一个单选按钮。谁能帮我?这是我项目的代码
string NewFilePath = "E:\\Tables.txt";
string[] Records = File.ReadAllLines(NewFilePath);
foreach (string items in Records)
{
RadioButton a = new RadioButton();
a.Click += new EventHandler(a_Click);
a.Appearance = Appearance.Button;
a.Font = new Font("Cambria", 10, FontStyle.Regular);
a.Width = 75;
a.Height = 50;
a.FlatStyle = FlatStyle.Standard;
a.Cursor = Cursors.Hand;
a.Name = items;
a.Text = items.ToString();
a.TextAlign = ContentAlignment.MiddleCenter;
a.BackColor = Color.White;
a.ForeColor = Color.Black;
pnlCustomrdb.Controls.Add(a);
}