winForm打开及关闭处理事件一览
2008-07-10 18:24
459 查看
Windows Forms 程式設計
Windows Form 中事件的順序
對於需要輪流處理 Windows Form 應用程式中每個事件的開發人員來說,事件的引發順序就十分重要。當某個狀況呼叫嚴密的事件處理,如重新繪製表單的部分時,有必要瞭解事件在執行階段時的明確引發順序。本說明主題提供了有關事件順序的詳細資訊,這些事件是指在應用程式和控制項的存留期 (Lifetime) 幾個重要階段中的事件。如需滑鼠輸入事件之順序的詳細資訊,請參閱 Windows Form 中的滑鼠事件。如需 Windows Form 事件的概觀,請參閱事件概觀 (Windows Form)。如需事件處理常式之構成的詳細資訊,請參閱事件處理常式概觀 (Windows Form)。
應用程式啟動與關閉事件
Form 和 Control 類別會公開一組和應用程式啟動與關閉有關的事件。當 Windows Form 應用程式啟動時,會以下列順序引發主要表單的啟動事件:
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 Form 中事件的順序
對於需要輪流處理 Windows Form 應用程式中每個事件的開發人員來說,事件的引發順序就十分重要。當某個狀況呼叫嚴密的事件處理,如重新繪製表單的部分時,有必要瞭解事件在執行階段時的明確引發順序。本說明主題提供了有關事件順序的詳細資訊,這些事件是指在應用程式和控制項的存留期 (Lifetime) 幾個重要階段中的事件。如需滑鼠輸入事件之順序的詳細資訊,請參閱 Windows Form 中的滑鼠事件。如需 Windows Form 事件的概觀,請參閱事件概觀 (Windows Form)。如需事件處理常式之構成的詳細資訊,請參閱事件處理常式概觀 (Windows Form)。
應用程式啟動與關閉事件
Form 和 Control 類別會公開一組和應用程式啟動與關閉有關的事件。當 Windows Form 應用程式啟動時,會以下列順序引發主要表單的啟動事件:
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 事件會在主要表單的關閉事件之後引發。
相关文章推荐
- winForm打开及关闭处理事件一览
- Winform模态窗体关闭时赋值给打开自身的窗体(C# 事件委托版)
- WINFORM 父窗体Load事件中打开子窗体并关闭自身
- Winform模态窗体关闭时赋值给打开自身的窗体(C# 事件委托版)
- wince下强制使用重载的方式来解决窗口打开、关闭时的事件处理
- Winform窗口渐进打开关闭效果实现
- 蛋疼的让C#控制台程序(Console)像窗体(Winform)一样(关闭,托盘图标,事件响应,手动退出等)
- 关闭用户打开的进程处理
- WinForm枚举容器中的控件,实现控件统一事件处理机制
- [转]使用C#打开新窗口关闭旧窗口的方法;winform中防止重复打开多个相同子窗体
- 一个WinForm记事本程序(包含主/下拉/弹出菜单/打开文件/保存文件/打印/页面设置/字体/颜色对话框/剪切版操作等等控件用法以及记事本菜单事件/按键事件的具体代码)
- 浏览器右键、刷新、默认事件、打开新窗口、关闭
- MFC应用程序中处理消息的顺序,创建窗口的过程关闭窗口的顺序(非模态窗口),打开模式对话框的函数调用顺序
- 浏览器关闭事件的处理
- C#控制台程序中处理2个关闭事件的代码实例
- 浏览器关闭事件处理
- 一个WinForm记事本程序(包含主/下拉/弹出菜单/打开文件/保存文件/打印/页面设置/字体/颜色对话框/剪切版操作等等控件用法以及记事本菜单事件/按键事件的具体代码)
- Tomcat服务器关闭监听事件的处理
- C# WinForm窗体中有控件时keyDown事件问题处理方式
- Winform 关闭事件