Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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!

like image 465
deerchao Avatar asked Nov 25 '25 21:11

deerchao


1 Answers

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.

like image 119
heavyd Avatar answered Nov 28 '25 13:11

heavyd



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!