Event using generic EventHandler<> not visible in Designer

前端 未结 1 880
抹茶落季
抹茶落季 2021-01-14 03:09

I\'ve just noticed that if I add an event using a generic eventhandler to my UserControl, the event is not visible in the designer when I add the user control to a form.

1条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-14 03:28

    The Windows Forms designer has limited support for generic types. It will work okay when you avoid the generic type argument for EventHandler:

        public class TEventArgs : EventArgs { }
        public class MyEventArgs : TEventArgs { }
        public event EventHandler EventNowAlsoVisibleInDesigner;
    

    0 讨论(0)
提交回复
热议问题