111,118
社区成员
发帖
与我相关
我的任务
分享
public void play(object sender, EventArgs e)
{
Button b = (Button)sender;
MessageBox.Show(b.Name);
}
private void Form1_Load(object sender, EventArgs e)
{
Button a = new Button();
a.Name = "a";
Button b = new Button();
b.Name = "b";
this.Controls.Add(b);
this.Controls.Add(a);
a.Click += new EventHandler(play);
b.Click += new EventHandler(play);
}