斜体部分替换成自己需要的
private bool HasValueChangedEventHandler(DateTimePicker b) { FieldInfo f1 = typeof(DateTimePicker).GetField("onValueChanged", BindingFlags.Instance | BindingFlags.NonPublic); var handler = (EventHandler)f1.GetValue(b); return handler != null; }
Winform判断EventHandler是否已经添加,布布扣,bubuko.com
原文:http://www.cnblogs.com/eshizhan/p/3706120.html