C# Windows Forms Design-time Form constructor not called?

老子叫甜甜 提交于 2019-12-02 10:23:46

This behavior is by design. The form designer in Visual Studio cannot instantiate the class being designed — instead, it instatiates its immediate parent. There is no way to change this behavior. If you need some logic to be executed during design time, you have to create a separate ancestor encapsulating that logic and inherit from it.

That's also the reason why in order to be able to use the designer you cannot inherit a form from an abstract or generic class.

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