C#中WinForm窗体事件的执行次序如下:

来源:互联网 发布:java random.nextint 编辑:程序博客网 时间:2024/05/22 01:49

 

new
load
paint
activated
deactivate
closing
closed
dispose

当 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

0 0