访问所有表单加载事件 [英] Accessing all the forms load event

查看:70
本文介绍了访问所有表单加载事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我需要使用一种方法来访问所有表格
在我的项目中加载事件.
不打开每个表格怎么可能
然后打开其加载事件.

有很多形式可以一一完成.

请提供任何帮助>

Hi all,

I need to use one method to access all the forms
Load events in my project.
How is this possible without opening every form
and then opening its load event.

There is to much forms to do this one by one.

Please any help would be appriciated>

推荐答案

我们提供的任何解决方案都要求您仍然更改每个表单类,因此请习惯一下!

最简单的方法是声明自己的MyForm类(从Form派生),该类处理Load事件并从中派生所有表单,而不是Form
这将捕获
Any solution we gave would require you to change every form class anyway, so get used to it!

The simplest way to do it is to declare your own MyForm class (derived from Form), which handles the Load event and derive all your forms from that instead of Form
This would catch all the uses of
formThis thisForm = new formThis();

的所有用法,而无需手动将事件处理程序添加为很好.

without having to manually add the event handler as well.


这篇关于访问所有表单加载事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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