111,126
社区成员
发帖
与我相关
我的任务
分享
public partial class Form1 : Form
{
public EventHandler EH;
public Form1()
{
InitializeComponent();
Button b1 = new Button();
b1.Click += EH;
this.Controls.Add(b1);
}
private void button1_Click(object sender, EventArgs e)
{
EH = test;
}
private void test(object sender,EventArgs e)
{
MessageBox.Show("ddddddddddddd");
}
}
Button b1 = new Button();
b1.Click += test;
this.Controls.Add(b1);
public partial class Form1 : Form
{
public EventHandler EH;
public Form1()
{
InitializeComponent();
Button b1 = new Button();
b1.Name = "b1";
this.Controls.Add(b1);
}
private void button1_Click(object sender, EventArgs e)
{
EH = test;
this.Controls["b1"].Click += EH;
}
private void test(object sender,EventArgs e)
{
MessageBox.Show("ddddddddddddd");
}
}