110,539
社区成员
发帖
与我相关
我的任务
分享
protected virtual void OnButton1Click()
{
//.....
}
public event EventHandler<EventArgs> MyEvent;
protected void OnButton1Click()
{
if (MyEvent != null)
MyEvent(this, new EventArgs());
}
private void button1_Click(object sender, EventArgs e)
{
a();
}
那么你可以把它提取出来,例如 private void button1_Click(object sender, EventArgs e)
{
OnButton1Click();
}
protected void OnButton1Click()
{
a();
}
这样就可以调用了。