zoukankan      html  css  js  c++  java
  • 查询一个控件注册的事件集合,并调用

    https://blog.csdn.net/lt045508/article/details/68921433


                PropertyInfo propertyInfo = this.panel1.GetType().GetProperty("Events", BindingFlags.Instance | BindingFlags.NonPublic);
                if (propertyInfo == null)
                { return; }
                EventHandlerList eventList = (EventHandlerList)propertyInfo.GetValue(this.panel1, null);
                FieldInfo fieldInfo = typeof(Control).GetField("EventClick", BindingFlags.Static | BindingFlags.NonPublic);
                if (fieldInfo == null)
                { return; }
                Delegate delegateInfo = eventList[fieldInfo.GetValue(this.panel1)];
                if (delegateInfo == null) { return; }
                Delegate[] delegateList = delegateInfo.GetInvocationList();

                this.Invoke(delegateList[0], this.panel1, null);
                this.Invoke(delegateList[1], this.panel1, null);

  • 相关阅读:
    C
    B
    D
    I
    B
    E
    B
    L
    H
    bzoj3276磁力 两种要求下的最大值:分块or线段树+拓扑
  • 原文地址:https://www.cnblogs.com/81/p/10198446.html
Copyright © 2011-2022 走看看