Reputation: 868
I want to ask about function InitializeComponent()
. Is called after Invalidate()
- invalidating component?
Version: .net 4.5, VS 2012
Upvotes: 4
Views: 2442
Reputation: 52808
No, InitializeComponent()
is only ever called in the constructor.
That is, unless you decide to call it yourself from within one of your methods.
There is no interface, nor base class that requires your form to have a method called InitializeComponent()
, it's just that's what Visual Studio's WinForms designer calls the method.
Upvotes: 5
Reputation: 3528
The "InitializeComponent"
must be called once at the constructor. The reason this function exists is to separate the designer code initialization and your implementation. It does all the new things for private variables generated with the designer. You can see the implementation of the function by hittin F12 on it.
Hope it helps.
Cheers
Upvotes: 0
Reputation: 3063
If you have InitializeComponent() method call only in form constructor, than it is called only once, while initializing form.
If you manualy added InitializeComponent() in another place, for example, before you call Invalidate(), than yes.
Upvotes: 0