如何在表单加载后执行代码? [英] How do I execute code AFTER a form has loaded?

查看:116
本文介绍了如何在表单加载后执行代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在.NET中,Windows窗体在窗体加载之前有一个事件触发(Form.Load),但是在加载窗体之后没有相应的事件触发。我想在表单加载后执行一些逻辑。

In .NET, Windows Forms have an event that fires before the Form is loaded (Form.Load), but there is no corresponding event that is fired AFTER the form has loaded. I would like to execute some logic after the form has loaded.

任何人都可以提供解决方案?

Can anyone advise on a solution?

推荐答案

您可以使用显示事件: MSDN - Form.Shown

You could use the "Shown" event: MSDN - Form.Shown

仅当第一次显示窗体时,显示所显示的事件;随后最小化,最大化,恢复,隐藏,显示或无效和重画不会引发此事件。

"The Shown event is only raised the first time a form is displayed; subsequently minimizing, maximizing, restoring, hiding, showing, or invalidating and repainting will not raise this event."

这篇关于如何在表单加载后执行代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆