C # winforms - calling InitializeComponent () function during update?

I want to ask about the InitializeComponent() function. Called after Invalidate() , an invalid component?

Version: .net 4.5, VS 2012

+4
source share
3 answers

No, InitializeComponent() is called only in the constructor.

That is, if you do not decide to call it yourself from one of your methods.

There is no interface or base class that requires your form to have a method called InitializeComponent() , it's just that the Visual Studio WinForms designer calls the method.

+5
source

If you call the InitializeComponent () method only in the form constructor, then it is called only once when the form is initialized.

If you manually added InitializeComponent () to a different place, for example, before calling Invalidate (), than yes.

0
source

"InitializeComponent" must be called once in the constructor. The reason this function exists is to separate the initialization of the designer code and your implementation. It does all new things for private variables generated using the constructor. You can see the implementation of the hittin F12 function on it.

Hope this helps.

Greetings

0
source

Source: https://habr.com/ru/post/1444670/


All Articles