斜体部分替换成自己需要的
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
时间: 2024-10-14 15:12:27