程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> .NET網頁編程 >> .NET實例教程 >> windows窗體中的事件順序

windows窗體中的事件順序

編輯:.NET實例教程

對於關注對 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 事件在主窗體的關閉事件之後引發。

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved