查看控件的事件绑定

来源:互联网 发布:ga遗传算法c 实现 编辑:程序博客网 时间:2024/05/22 13:52
            System.Reflection.PropertyInfo propertyInfo = (typeof(Control)).GetProperty("Events", BindingFlags.Instance | BindingFlags.NonPublic);            EventHandlerList eventHandlerList = (EventHandlerList)propertyInfo.GetValue(this.axMapControl2 as Control, null);            System.Reflection.FieldInfo fieldInfo = (typeof(Control)).GetField("EventMouseEnter", BindingFlags.Static | BindingFlags.NonPublic);            Delegate d = eventHandlerList[fieldInfo.GetValue(null)];            if (d != null)            {                foreach (Delegate temp in d.GetInvocationList())                {                    Console.WriteLine(temp.Method.Name);                }            }

0 0
原创粉丝点击