TextBox.SelectAll()不与TAB工作 [英] TextBox.SelectAll() does not work with TAB
问题描述
我使用 maskedTextBox.SelectAll()
来突出显示输入
和<$在MaskedTextBox中文字C $ C>的MouseDown 事件。
I am using maskedTextBox.SelectAll()
to highlight the text in the MaskedTextBox in the Enter
and MouseDown
events.
它的工作原理,当我用鼠标,但我去那个文本框按<大骨节病>标签骨节病>键,这是行不通的。
It works when I use the mouse, but I go to that textbox by pressing the Tab key, it does not work.
我缺少的是在这里吗?
推荐答案
您是否尝试过的 的GotFocus
事件?
Have you tried the GotFocus
event?
当您使用键盘(TAB,Shift + Tab等),通过调用选择或SelectNextControl方法,或者通过ContainerControl.ActiveControl属性设置为当前窗体更改焦点,焦点事件发生的顺序如下:
When you change the focus by using the keyboard (TAB, SHIFT+TAB, and so on), by calling the Select or SelectNextControl methods, or by setting the ContainerControl.ActiveControl property to the current form, focus events occur in the following order:
它接着列出被解雇的事件。它看起来像这样的火灾时,鼠标的使用,所以你可能只需要这个处理程序。
It then goes on to list the events that are fired. It looks like this fires when the mouse is used so you might only need this handler.
这篇关于TextBox.SelectAll()不与TAB工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!