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);

  • 相关阅读:
    git 去除对某个文件的版本控制
    10:08 小记
    写读书笔记
    恢复已删除且已添加至暂存区的文件
    第七周
    第六周
    软件测试
    短信获取
    Android-8
    增删改查
  • 原文地址:https://www.cnblogs.com/81/p/10198446.html
Copyright © 2011-2022 走看看