如何在Windows应用程序中检查文本框焦点true或false [英] How to check textbox focus true or false in windows application

查看:67
本文介绍了如何在Windows应用程序中检查文本框焦点true或false的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Windows应用程序中检查文本框焦点是true还是false



点击button1检查文本框焦点?

是当前文本框焦点:

how to check whether textbox focus true or false in windows application

when click on button1 check textbox focus ?
is current textbox focus:

if(txtname.focus()==true)//when click on button1_click first check correcttextbox focus is correct than label text "A" there wise not exit
{
label.text="A";
}





我的尝试:



如何在Windows应用程序中检查文本框焦点的真或假



What I have tried:

how to check textbox focus true or false in windows application

推荐答案

当您单击按钮时,它是获得焦点的按钮,不是文本框。如果要在按钮单击之前检查最后一个聚焦控件,请检查以下内容: c# - 找出最后一个焦点的控件 - Stack Overflow [ ^ ]
When you click on the button, it is the button that got the focus, not the textbox. If you want to check the last focused control prior to the button click, check this out: c# - Find out the control with last focus - Stack Overflow[^]


这篇关于如何在Windows应用程序中检查文本框焦点true或false的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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