分享

Winform窗体事件发生顺序

 kittywei 2012-04-02
Form 和Control 类公开了一组与应用程序启动和关闭相关联的事件。当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 事件在主窗体的关闭事件之后引发。
 
 因此,如果你想让窗体在加载后自动隐藏,就应该把隐藏语句加在Shown里而不是Load。

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多