public Form1()
{
InitializeComponent(); this.Load+=new EventHandler(Form1_Load1);
this.Load+=new EventHandler(Form1_Load2); PropertyInfo propertyInfo = (typeof(Form)).GetProperty("Events", BindingFlags.Instance | BindingFlags.NonPublic);
EventHandlerList eventHandlerList = (EventHandlerList)propertyInfo.GetValue(this, null);
FieldInfo fieldInfo = (typeof(Form)).GetField("EVENT_LOAD", BindingFlags.Static | BindingFlags.NonPublic); Delegate d = eventHandlerList[fieldInfo.GetValue(null)]; if (d != null)
{
foreach (Delegate de in d.GetInvocationList())
Console.WriteLine(de.Method.Name);
}
}
private void Form1_Load1(object sender, EventArgs e)
{
//什么也不干
}
private void Form1_Load2(object sender, EventArgs e)
{
//什么也不干
}
}这里面的“EVENT_LOAD”是???在哪个类里面能找到啊??
{
InitializeComponent(); this.Load+=new EventHandler(Form1_Load1);
this.Load+=new EventHandler(Form1_Load2); PropertyInfo propertyInfo = (typeof(Form)).GetProperty("Events", BindingFlags.Instance | BindingFlags.NonPublic);
EventHandlerList eventHandlerList = (EventHandlerList)propertyInfo.GetValue(this, null);
FieldInfo fieldInfo = (typeof(Form)).GetField("EVENT_LOAD", BindingFlags.Static | BindingFlags.NonPublic); Delegate d = eventHandlerList[fieldInfo.GetValue(null)]; if (d != null)
{
foreach (Delegate de in d.GetInvocationList())
Console.WriteLine(de.Method.Name);
}
}
private void Form1_Load1(object sender, EventArgs e)
{
//什么也不干
}
private void Form1_Load2(object sender, EventArgs e)
{
//什么也不干
}
}这里面的“EVENT_LOAD”是???在哪个类里面能找到啊??
解决方案 »
- treeView问题,在线等!!!
- 如何创建类实例的深层副本
- out 数组总是提示有些路竟没有赋值
- C#打印问题
- 请问哪位兄弟用C#做过类似的表单设计器吗?
- c#winform中GDI+在panel里的paint里画图,每次下拉时重画怎么那么闪啊?用什么更好的解决办法没有?
- 打印标签问题~~~~寻找好的方案
- 异常详细信息: System.InvalidOperationException: .Net 数据 SQL 提供程序(System.Data.SqlClient)要求 Microsoft 数据访问组件(MDAC) 2
- C#中有专门输入IP地址的控件么
- 两个关于ListBox的问题
- 将多个excel里的内容提取到一个excel里
- 感谢散分帖!chuhuabing songhtao sq_zhuyi xisat 请入~~~
而且还是全大写的
反射获得组件的事件,通过TypeDescriptor的GetEvents方法更好。