gpt4 book ai didi

.net - 封闭式和封闭式事件的区别

转载 作者:行者123 更新时间:2023-12-04 19:13:52 25 4
gpt4 key购买 nike

只是想知道 Form.Closed 之间的最大区别是什么和 Form.FormClosed order of events of Windows Application 中的事件.我已经在 MSDN 文档中阅读过它,但仍然找不到任何与彼此不同的东西。请解释。

最佳答案

MSDN says :

The Closed event is obsolete in the .NET Framework version 2.0; use the FormClosed event instead.



我认为你甚至不应该考虑使用这个事件。它已被弃用和隐藏,但它只是为了与旧源代码兼容。

它与 FormClosed 的含义相同事件,但有一个(不是那么多)细微差别,正如您在 MSDN 上看到的 Closed由于对 Application.Exit() 的调用,当应用程序存在时不会引发事件但 FormClosed是。

这种行为也记录在上面的链接中:

The Form.Closed and Form.Closing events are not raised when the Application.Exit method is called to exit your application. If you have validation code in either of these events that must be executed, you should call the Form.Close method for each open form individually before calling the Exit method.

关于.net - 封闭式和封闭式事件的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12320987/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com