日期:2014-05-18 浏览次数:21048 次
private void button1_Click(object sender, EventArgs e)
{
button2_Click(button2,new EventArgs());
}
private void button2_Click(object sender, EventArgs e)
{
}
------解决方案--------------------
this.button1.Click += new System.EventHandler(this.button1_Click); this.button1.Click += new System.EventHandler(this.button2_Click);
------解决方案--------------------
这个简单,
在Form.Designer.cs下把 你的按钮1的方法改为:
this.button1.Click += new System.EventHandler(this.button1_Click_1)+new System.EventHandler(this.button2_Click);
嘿嘿......
------解决方案--------------------
private void button1_Click (Object sender,
EventArgs e)
{
// If myVar is an even number, click Button2.
if(myVar %2 == 0)
{
button2.PerformClick(); // <------------------------------------
// Display the status of Button2's Click event.
MessageBox.Show("button2 was clicked ");
}
else
{
// Display the status of Button2's Click event.
MessageBox.Show("button2 was NOT clicked");
}
// Increment myVar.
myVar = myVar + 1;
}
------解决方案--------------------
七楼的我不是很懂,但我觉得四楼的比较符合逻辑