Forms Event model

  • Thread starter Thread starter Guest
  • Start date Start date
Thanks for the response. I was actually looking for the document that listed
the matrix of winform control event sequences during its lifecycle.

Thanks anyway.
 
Hi,

There is not special lifecycle in windows forms as there is for webforms
application. The reason being is that the mechanism used by web pages for
serving requests and creation and building control hierarchies is more
complex. Web pages has short life where winforms forms once created leave
until they are no longer needed. In other words there is no cycle in their
life, so you won't find such a document.

There are some event sequences, but they are related to a concrete scenarios
e.g. what is the order of events and virtual method calls when an user
presses a keyboard key, moves the mouse, control verification, etc. Maybe if
you are more specific in your question you can find the answer.
 
Thanks for the response.

There is a certain sequence during initialization, activation, and disposing.

Upon initialization, after the ctor is called, if the control is a Form
type, can you confirm what I believe the event firing sequence is? i.e.,
Load, HandleCreated, Layout, Paint, ReSize, SizeChanged, Activate,
GotFocus, Shown

Otherwise, I tried to find some time to write a test Form to confirm. I just
thought a document existed somewhere.

thx
 
Upon initialization, after the ctor is called, if the control is a Form
type, can you confirm what I believe the event firing sequence is? i.e.,
Load, HandleCreated, Layout, Paint, ReSize, SizeChanged, Activate,
GotFocus, Shown

As stated in another response, the order of events can depend on the user's
interaction with the form. However, if you simply open a form then close it
again, the form's events occur in the following order:

Load
Layout
VisibleChanged
Activated
Paint
Closing
Closed
Deactivate
 
Back
Top