处理所有形式的事件 [英] Handle an event in all Forms

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

问题描述

我有很多表格(每个表格都包含文本框),例如,我想
通过一个处理程序处理所有形式的keypress事件...
但是如何? :confused:

I have many forms(each form contains textbox) ,and for example I want to
handle the keypress event in all forms with one handler...
but How? :confused:

推荐答案

使包装器比比皆是一个标准按钮,基本上是创建一个自定义按钮,可以说它是BaseButton.具有此BaseButton的默认实现,因此是一个处理程序.

现在,在所有表单上使用此BaseButton.如果需要,请对任何单个按钮/窗体覆盖处理程序以执行不同的代码.
Make a wrapper abound a standard button, basically create a custom button, lets say it as BaseButton. Have a default implementation of this BaseButton, thus one handler.

Now, use this BaseButton on all the forms. If needed, override the handler for any single button/form to execute a different code.


这篇关于处理所有形式的事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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