如何获得当前的重点控制 [英] how to get currently focused control

查看:67
本文介绍了如何获得当前的重点控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 我正在Windows窗体应用程序上工作,我需要在窗体上使用key_press事件.如果当前将key_press事件应用于文本框,那么我将做一些事情.
所以问题是,我将如何在我的代码后面知道当前关注的控件是文本框?
任何帮助将不胜感激. :)

解决方案

其中一些链接会为您提供答案.
http://stackoverflow.com/Questions/660173/how-do-i-find-out-which-control-has-focus-in-net-winforms [ http://stackoverflow.com/Questions/435433/what-is-the-preferred-to-preferred-way-to-find-focused-control-in-winforms-app [ ^ ]

http://community.devexpress.com/forums/p/76720/262785.aspx [ ^ ]


hi i am working on a windows form application and i face a necessity to use key_press event on the form. and if the key_press event is currently applied for the textboxes then i will do something.
so the question is that how i will come to know in my code behind that the currently focused control is a textbox??
any help will b highly appreciated. :)

解决方案

Some of these links will get you an answer.. Its not straight forward though..

http://stackoverflow.com/questions/660173/how-do-i-find-out-which-control-has-focus-in-net-winforms[^]


http://stackoverflow.com/questions/435433/what-is-the-preferred-way-to-find-focused-control-in-winforms-app[^]

http://community.devexpress.com/forums/p/76720/262785.aspx[^]


这篇关于如何获得当前的重点控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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