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。

转载于:https://www.cnblogs.com/candyzhmm/p/5535031.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值