110,534
社区成员
发帖
与我相关
我的任务
分享
GetInvocationList
Type t = button1.GetType();
PropertyInfo pi = t.GetProperty("Events", BindingFlags.Instance | BindingFlags.NonPublic);
EventHandlerList ehl = (EventHandlerList)pi.GetValue(button1, null);
FieldInfo fieldInfo = (typeof(Control)).GetField("EventClick", BindingFlags.Static | BindingFlags.NonPublic);
Delegate d = ehl[fieldInfo.GetValue(null)];
if (d != null)
{
foreach (Delegate temp in d.GetInvocationList())
{
MessageBox.Show(temp.Method.Name);
}
}