Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
使用 MDI 表单时,是否有任何标准方法来保存和恢复状态(打开了哪些表单以及在屏幕上的哪个位置)?
是的,我可以将 MdiChildren 中的值保存到文件并在应用程序启动时恢复它们。那不是我要找的。
有没有标准的方法来做到这一点?
如果您有比从 MdiChildren 序列化值更好的方法,请发布它。
经过一番搜索,得出以下结论:
不,没有标准解决方案。
编写恢复窗口及其状态所需的数据部分非常容易。只需序列化并写入ClosedMdiParent 上事件的文件。(像这样Application.Exit的事件来不及序列化。表单已经关闭)。
Closed
Application.Exit
读回来,填充你想要的任何东西,然后在 MdiParentShow上形成子窗体。Load
Show
Load
我会接受这个作为答案,因为它是我使用的,我不喜欢留下未回答的问题。