How to Change Base class of Designer generated class from System.Windows.Forms.Form to my own BaseForm

久未见 提交于 2019-12-02 00:00:55

问题


Everytime I add a new Form to my WinForms project, the designer generates code of a new class which inherits from System.Windows.Forms.Form.

For some reason, I want it to inherit from my own BaseForm class. Any way to automate it other than editing the generated file myself?

Thanks!


回答1:


This is actually a scenario that Visual Studio supports directly. From your project add a new item. From the dialog that is displayed select "Inherited Form." The next window should let you select the base form you want to use for your new form.



来源:https://stackoverflow.com/questions/5347498/how-to-change-base-class-of-designer-generated-class-from-system-windows-forms-f

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