Manual editing of *.designer.cs file

前端 未结 5 1354
时光取名叫无心
时光取名叫无心 2020-11-28 16:29

I\'m aware, that the .designer.cs file contains data generated by the visual form designer in Visual Studio. However, I have some additional methods though, whi

5条回答
  •  囚心锁ツ
    2020-11-28 17:05

    Partial designer form class it's used by Visual Studio for placing all code need for build the control.

    The method InitializeComponent() can't be overwrite: it's used by designer editor for render a preview of your form! Try in a new project: resize your form, add a label and a button and rename the InitializeComponent() method + re-compile. Your form back to default size!

    If you need to call code by form loading, just override OnLoad() virtual method, if you need to call code by form showing, simple override OnShown() virtual method.

    Remember to call the base.Method() at begin of it override.

    Hope this little my experience can help!

提交回复
热议问题