运行事件

编程入门 行业动态 更新时间:2024-10-07 18:20:09
本文介绍了运行事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个事件,例如:

私有无效测试(对象发送者,AutomationEventArgs e)

private void test(object sender,AutomationEventArgs e)

{

int a = 10;

int a=10;

a + = 10;

a+=10;

}

现在我希望关闭此事件后,我可以说运行一些事件

now i want that after close this event i can say run some events

怎么做;

请帮助我,很紧急

推荐答案

您可以调用一个事件:

public event EventHandler MyEvent;protected virtual void OnEvent(EventArgs e) { var eh = this.MyEvent; if (eh != null) { eh(this, e); } }private void test(object sender,AutomationEventArgs e) { int a=10; a+=10; this.OnEvent(new EventArgs()); }

我希望这会有所帮助,但可能是我弄错了您要怎么做... 这也可能会有所帮助: msdn.microsoft/zh-cn/library/aa720046%28v=vs.71%29.aspx

I hope this is helpful, but may be I got it wrong what your are going to do... This may be helpful too: msdn.microsoft/en-us/library/aa720046%28v=vs.71%29.aspx

更多推荐

运行事件

本文发布于:2023-11-25 06:15:06,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1628637.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:事件

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!