windows窗体中的事件顺序
2007-12-01 16:32
253 查看
对于关注对 Windows 窗体应用程序中引发的每个事件按次序进行处理的开发人员来说,事件引
发的顺序特别重要。当某种情况需要小心处理事件时(如重绘窗体的某些部分时),必须知道
事件在运行时的确切引发顺序。本文提供了一些有关在应用程序和控件的生命周期中的几个重
要阶段中的事件顺序的详细信息
当 Windows 窗体应用程序启动时,主窗体的启动事件按以下顺序引发:
System.Windows.Forms.Control.HandleCreated
System.Windows.Forms.Control.BindingContextChanged
System.Windows.Forms.Form.Load
System.Windows.Forms.Control.VisibleChanged
System.Windows.Forms.Form.Activated
System.Windows.Forms.Form.Shown
当应用程序关闭时,主窗体的关闭事件按以下顺序引发:
System.Windows.Forms.Form.Closing
System.Windows.Forms.Form.FormClosing
System.Windows.Forms.Form.Closed
System.Windows.Forms.Form.FormClosed
System.Windows.Forms.Form.Deactivate
Application 类的 ApplicationExit 事件在主窗体的关闭事件之后引发。
发的顺序特别重要。当某种情况需要小心处理事件时(如重绘窗体的某些部分时),必须知道
事件在运行时的确切引发顺序。本文提供了一些有关在应用程序和控件的生命周期中的几个重
要阶段中的事件顺序的详细信息
当 Windows 窗体应用程序启动时,主窗体的启动事件按以下顺序引发:
System.Windows.Forms.Control.HandleCreated
System.Windows.Forms.Control.BindingContextChanged
System.Windows.Forms.Form.Load
System.Windows.Forms.Control.VisibleChanged
System.Windows.Forms.Form.Activated
System.Windows.Forms.Form.Shown
当应用程序关闭时,主窗体的关闭事件按以下顺序引发:
System.Windows.Forms.Form.Closing
System.Windows.Forms.Form.FormClosing
System.Windows.Forms.Form.Closed
System.Windows.Forms.Form.FormClosed
System.Windows.Forms.Form.Deactivate
Application 类的 ApplicationExit 事件在主窗体的关闭事件之后引发。
相关文章推荐
- Windows 窗体启动和关闭的事件顺序
- Windows 窗体中的事件顺序
- Windows 窗体启动和关闭的事件顺序
- Windows 窗体启动和关闭的事件顺序
- Windows 窗体启动和关闭的事件顺序
- Windows 窗体中的事件顺序
- Windows 窗体启动和关闭的事件顺序
- Windows 窗体启动和关闭的事件顺序
- 关于 OnCloseQuery: 顺序、不能关机等(所有的windows的广播消息都是逐窗口传递的)——如果一个窗体的OnCloseQuery事件中如果写了代码那么WM_QUERYENDSESSION消息就传不过去了msg.result会返回0,关机事件也就停止了
- Windows 窗体启动和关闭的事件顺序
- Windows 窗体应用程序中引发事件的顺序
- Windows 窗体中的事件顺序
- Windows 窗体中的事件顺序
- 在 Visual C# .NET 中处理 Windows 窗体中 Office XP 电子表格组件的事件
- Windows窗体Paint()事件
- Order of Events in Windows Forms——Windows Foms 事件加载顺序
- C# 窗体运用程序加载,事件触发顺序
- Visual C# 2008+SQL Server 2005 数据库与网络开发-- 12.3 Windows窗体程序中的事件
- WPF中 Window 窗体加载的时候的事件的执行顺序
- 扩充.NET窗体类(System.Windows.Forms.Form)的事件