我想知道如何保留创建的最后一个按钮的位置或靠近面板末端的位置,以便在它之后添加一个。此外,我希望这个新按钮在其名称中采用最后一个索引之后的索引,如果再次单击该按钮,则名称将为 addstrat_3
我的代码是:
private void addstrat_i_Click(object sender, EventArgs e)
{
panel3strat.Width += 200;
Button addstrat_2 = new Button();
panel3strat.Controls.Add(addstrat_2);
addstrat_2.Size = new Size(210, 41);
addstrat_2.Location = new Point(31,89);
addstrat_2.Visible = true;
}
在这种情况下,我将按钮放在命名位置,但我只想在最后一个下方创建它并使用新名称。
任何想法 ?
谢谢