【发布时间】:2021-12-08 22:34:34
【问题描述】:
所以我想为txt制作一个方法,但我不知道如何。我记得它是带有“=>”运算符的东西,但我不记得正确的语法。有人能帮我吗?这是代码:
private void button1_Click(object sender, EventArgs e)
{
ex_y += 25;
n = int.Parse(textBox1.Text);
for (int i = 0; i < n; i++)
{
Button b = new Button();
this.Controls.Add(b);
b.Size = new Size(50, 50);
b.Location = new Point(ex_x + b.Width + 25, ex_y);
ex_x = b.Location.X;
b.Text = rand.Next(0, 100).ToString();
a[i] = int.Parse(b.Text);
rand.Next(0, 100);
TextBox txt = new TextBox();
this.Controls.Add(txt);
txt.Size = new Size(b.Size.Width, 50);
txt.Location = new Point(b.Location.X, b.Location.Y + 60);
txt.BackColor = Color.White;
}
}
【问题讨论】: