|
Button a = null;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
for (int i = 0; i < 2; i++)
{
a = new Button();
a.Text = i.ToString();
this.flowLayoutPanel1.Controls.Add(a);
a.Click += new System.EventHandler(this.button1_Click);
}
}
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show(a.Text);
}
在面板上就有2个按钮了 但是不管点哪个都是 2
我想实现的是 点1 弹出1 点2 弹出 2 |
|