What is the standard approach for event handling in case of Visual Inheritance?

心已入冬 提交于 2019-12-08 07:25:26

The designer honors the access modifiers on the base class members. You must change the Modifiers property of the base form's control from Private to Protected. Recompile. Now the inherited form has access to the control, you'll have no trouble overriding properties and assigning an event handler from the designer.

You handle the event on the base Form and use it to call a virtual method. The derived Form overrides that method.

Another method is to add an event in the user control (instead of a virtual method) and then fire it when the internal event is fired.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!