如何定义事件:

1、定义一个事件参数  继承与 EventArgs:

pulic class ActionEventArgs : EventArgs{}

2、定义一个事件委托: public delegate void ActionEventHanlder(object sender, ActionEventArgs e);

3、定义事件: public event ActionEventHanlder showProecc;

4、定义处理函数: pulic void Test(object sender, ActionEventArgs e){}

5、注册事件: showProecc+= new ActionEventHanlder(Test);

6、调用

Application.DoEvents(); --异步执行显示

ActionEventArgs arg=new ActionEventArgs();

showProecc(sendar,arg);

相关文章:

  • 2021-08-13
  • 2022-12-23
  • 2022-12-23
  • 2021-09-07
  • 2021-11-19
  • 2022-12-23
  • 2021-12-03
  • 2022-01-15
猜你喜欢
  • 2021-08-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-14
  • 2021-11-05
  • 2022-12-23
相关资源
相似解决方案