GetInvocationList
2015-11-30 16:09
260 查看
TextBox tb = sender as TextBox; if (tb != null) { EventHandlerList events = (EventHandlerList)typeof(Control).GetProperty("Events", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(tb, null); object key = typeof(Control).GetField("EventKeyPress", BindingFlags.NonPublic | BindingFlags.Static).GetValue(null); var tbEvent = events[key]; if (tbEvent != null) { var invokeLst = tbEvent.GetInvocationList(); if (invokeLst != null && invokeLst.FirstOrDefault() != null && Delegate.Equals(invokeLst.FirstOrDefault(), new KeyPressEventHandler(txtNumericOnly_KeyPress))) { ShowFieldValidationError(tb, CommonFunctions.OnlyAllowNumericEntry(tb, false, NumericValueType.Int32)); } if (invokeLst != null && invokeLst.FirstOrDefault() != null && Delegate.Equals(invokeLst.FirstOrDefault(), new KeyPressEventHandler(txtDecimalOnly_KeyPress))) { ShowFieldValidationError(tb, CommonFunctions.OnlyAllowNumericEntry(tb, true, NumericValueType.Decimal)); } } }
相关文章推荐
- 深入理解AMD模式下的Dijit
- Keil uVision(MDK)编译错误积累
- 返回顶部按钮的做法
- webxml详解版本二
- Intent的详细分析
- No package 'gobject-introspection-1.0' found
- C 查找字符在字符串首次出现的位置
- VC/MFC如何添加启动界面
- 【第11周 项目1 - 二叉树算法验证(3)中序线索化二叉树的算法验证】
- 调用系统默认铃声
- cocos2dx常见的46中+22中动作详解
- 无领导小组讨论(LGD)九大经典案例3
- 函数式思维: 函数设计模式,第 2 部分
- 学堂在线 C2-3实心菱形
- 百度地图api
- cocos2dx常见的46中+22中动作详解
- 第1讲 Redis部署与基本操作
- 第十三周项目5-拓扑排序算法的验证
- jsoncpp库的使用方法
- 什么是DOM