The full sequence of events fired for a Window object are as follows.
On application startup, if the Window is the application’s main window.
(Application events are also shown in the correct sequence).
- Application.Startup
- Window.Initialized
- Window.IsVisibleChanged
- Window.SizeChanged
- Window.LayoutUpdated
- Window.SourceInitialized
- Application.Activated
- Window.Activated
- Window.PreviewGotKeyboardFocus
- Window.IsKeyboardFocusWithinChanged
- Window.IsKeyboardFocusedChanged
- Window.GotKeyboardFocus
- Window.LayoutUpdated
- Window.Loaded
- Window.ContentRendered
On normal application shutdown, the event sequence is:
- Window.Closing
- Window.IsVisibleChanged
- Window.Deactivated
- Application.Deactivated
- Window.IsKeyboardFocusWithinChanged
- Window.IsKeyboardFocusedChanged
- Window.LostKeyboardFocus
- Window.Closed
- Application.Exit
When application/window loses focus (user switches to another application):
- Window.Deactivated
- Application.Deactivated
- Window.IsKeyboardFocusWithinChanged
- Window.IsKeyboardFocusedChanged
- Window.LostKeyboardFocus
When application/window gains focus (user switches back to application):
- Application.Activated
- Window.Activated
- Window.PreviewGotKeyboardFocus
- Window.IsKeyboardFocusWithinChanged
- Window.IsKeyboardFocusChanged
- Window.GotKeyboardFocus
When Developing Windows Applications using Windows Forms,
you will most likely find yourself needing to make user of the form’s
events, and this requires you to know when each form event fires.
In this short reference artivle I will show you the sequence of the form
events when the Form is being started and when it is being shut down.
When Form Start up
- Control.HandleCreated
- Control.BindingContextChanged
- Form.Load
- Control.VisibleChanged
- Form.Activated
- Form.Shown
When Form Shutdown
- Form.Closing
- Form.FormClosing
- Form.Closed
- Form.FormClosed
- Form.Deactivate
참고
http://wpf.2000things.com/2012/07/30/613-window-event-sequence/
http://www.daveoncsharp.com/2009/06/windows-forms-event-sequence/
'IT 나라 > 프로그램 이야기' 카테고리의 다른 글
그루보드5 설치 방법, 그루보드5 시작 (0) | 2016.05.16 |
---|---|
그누보드5 관리자 비밀번호 변경 방법 (0) | 2016.05.04 |
Sliding window (0) | 2013.07.02 |
COM Converting BSTR to CString and CString to BSTR, another CComBSTR, LPCTSTR, _bstr_t (0) | 2013.05.30 |
원도우 "서버 작업 중" 대화상자 출력 문제 해결 방법 (0) | 2013.05.03 |