带有控件的表单级别的KeyPress [英] KeyPress at form level with controls

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

问题描述

我想知道是否有可能在表单中有控件 时在表单级别 中处理 KeyPress 事件.

I am wondering if it is possible to handles KeyPress event at form level when there are controls in a form.

在窗体上没有控件时,我可以实现此目的,但是当我添加某些内容(如按钮)时,即使使用 Me.Focus ,窗体也会失去焦点,并且我无法将其退还给您

I can achieve this when there is no control on the form, but when i add something, like a button, the form loses the focus and i can't give it back, even with Me.Focus. The focus stays on the button.

有办法吗?如果没有,我想知道为什么.看起来很有趣.

Is there a way to do it ? If not, i would like to know why. Looks interesting.

推荐答案

您可以通过启用表单的KeyPrivew属性来实现.

You can do it by enabling KeyPrivew Property of your form.

这篇关于带有控件的表单级别的KeyPress的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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