• Winform窗体事件发生顺序


     

    Form 和Control 类公开了一组与应用程序启动和关闭相关联的事件。当Windows 窗体应用程序启动时,主窗体的启动事件按以下顺序引发:
     
    System.Windows.Forms.Control.HandleCreated  在为控件创建句柄时发生。
     
    System.Windows.Forms.Control.BindingContextChanged  BindingContext 属性的值更改时发生。
     
    System.Windows.Forms.Form.Load   在第一次显示窗体前发生。
     
    System.Windows.Forms.Control.VisibleChanged  在 Visible 属性值更改时发生。
     
    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。

  • 相关阅读:
    代码 技术债务 打分
    C++ boost coroutine
    什么是 Python Django Flask &Tornado
    Quartz应用与集群原理分析
    和开源产品对比
    Apache Storm || Processing real-time data
    认清自我,不在迷茫 程序员
    快速傅里叶变换算法
    Netty和Tomcat的区别、性能对比
    HTTP vs. MQTT ->TCP
  • 原文地址:https://www.cnblogs.com/candyzhmm/p/5535031.html
Copyright © 2020-2023  润新知