有办法取得事件的名字吗 obj.Click += new EventHandler(btn_Click);obj.Press += new EventHandler(btn_Press);obj.Connect += new EventHandler(btn_Connect); 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 public static Delegate[] GetObjectEventList(object p_Object, string p_EventName, Type p_EventType) { PropertyInfo _PropertyInfo = p_Object.GetType().GetProperty("Events", BindingFlags.Instance | BindingFlags.NonPublic); if (_PropertyInfo != null) { object _EventList = _PropertyInfo.GetValue(p_Object, null); if (_EventList != null && _EventList is EventHandlerList) { EventHandlerList _List = (EventHandlerList)_EventList; FieldInfo _FieldInfo = p_EventType.GetField(p_EventName, BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.IgnoreCase); if (_FieldInfo == null) return null; Delegate _ObjectDelegate = _List[_FieldInfo.GetValue(p_Object)]; if (_ObjectDelegate == null) return null; return _ObjectDelegate.GetInvocationList(); } } return null; } 获取扫描枪的数据---在线等 一个关于SVN的问题,用过SVN的请进 如何通过一个为实例化的对象获取其列名 在线等 这段代码的什么意思啊 求救,桌面应用程序中,怎么保存webbrowser中打开的Word文档? DataTable的拆分取值问题 突然发现Lambda表达式,只能 Application.Run(new Form1()); 中的new C#调用串口api函数,不能读写,急!!!各位高手帮忙啊! 请问哪位兄弟用C#做过类似的表单设计器吗? 求助:文本文件定时读取问题,谢谢! foreach操作的细节是什么呢
{
PropertyInfo _PropertyInfo = p_Object.GetType().GetProperty("Events", BindingFlags.Instance | BindingFlags.NonPublic);
if (_PropertyInfo != null)
{
object _EventList = _PropertyInfo.GetValue(p_Object, null);
if (_EventList != null && _EventList is EventHandlerList)
{
EventHandlerList _List = (EventHandlerList)_EventList;
FieldInfo _FieldInfo = p_EventType.GetField(p_EventName, BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.IgnoreCase);
if (_FieldInfo == null) return null;
Delegate _ObjectDelegate = _List[_FieldInfo.GetValue(p_Object)];
if (_ObjectDelegate == null) return null;
return _ObjectDelegate.GetInvocationList();
}
}
return null;
}