this.button1.Click += new System.EventHandler(this.button1_Click);//委托调用相关的程序

private void button1_Click(object sender, System.EventArgs e)
  {
  …
  }
///////////////////////////////////
委托的形式如下
[修饰符]  delegate 返回类型 委托名称(参数列表)

public delegate void AlarmEventHandler(object sender, AlarmEventArgs e);
///////////////////////
在运行时添加和移除事件处理程序
this.button2.Click += new
  System.EventHandler(this.button1_Click);
this.button2.Click -= new
System.EventHandler(this.button1_Click);

Posted on 2009-06-15 23:44  邬江-远波  阅读(175)  评论(0编辑  收藏  举报