C# 表单中Load事件、Activate事件和Enter事件的区别
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/696708/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Difference between Load event,Activate event and Enter event in the Form
提问by sivakumar
I am using VB.NET for Windows applications. What is the difference between Load event,Activate event and Enter event in the Form and in which order the above event is executed.Please anyone help me.
我正在将 VB.NET 用于 Windows 应用程序。表单中的 Load 事件、Activate 事件和 Enter 事件之间有什么区别以及上述事件的执行顺序。请任何人帮助我。
Sivakumar.P
西瓦库玛
回答by Galwegian
See the Windows Forms Events Lifecyclefor info.
有关信息,请参阅Windows 窗体事件生命周期。
回答by dommer
The Enter event is suppressed in Form. Its equivalent is Activated. Loaded occurs once during creation. Activated occurs whenever the Form becomes active (e.g. is selected by the user, opened, etc). Loaded comes before Activated.
Enter 事件在 Form 中被抑制。它的等价物是 Activated。Loaded 在创建期间发生一次。只要表单变为活动状态(例如被用户选择、打开等),就会发生 Activated 。加载在激活之前。
回答by Pushpa Dongare
Load: This event occurs before a form is displayed for the first time.
加载:此事件发生在第一次显示表单之前。
Activated: This event occurs when the form is activated in code or by the user.
Activated:当表单在代码中或由用户激活时发生。