为什么有些文本框不接受控制+ A快捷键来选择所有默认 [英] Why are some textboxes not accepting Control + A shortcut to select all by default
问题描述
我不知道这个问题是愚蠢的,但我在我自己的程序接受Control + A组合快捷键来选择整个文本默认和无编码在这里和那里找到一些文本框。
I don't know if the question is foolish, but i do find few textboxes here and there in my own program that accepts Control+A shortcut to select the entire text "by default" with "no coding".
我不知道我有什么额外的信息,因为我觉得这些文本框之间绝对没有区别给这里。 。这些都是简单的拖拽文本框
I dunno what additional informations I've to give here as I find absolutely no difference between those textboxes. Those are all simple dragged and dropped textboxes.
请注意:我不是在谈论这段代码:
Note: I'm not talking about this piece of code:
if (e.Control && e.KeyCode == Keys.A)
{
textBox1.SelectAll();
}
我想选择由default..Or反正是有改变文本框属性,以便该文本框接受所有默认的Windows快捷键
I want selection by default..Or is there anyway to change textbox property so that textboxes accept all default windows shortcuts.
编辑:其他的一切(控制+ Z
,控制+ X
,控制+ C
,控制+ V
)的工作原理是默认!为什么不控制+ A
??
Everything else (Control + Z
, Control + X
, Control + C
, Control + V
) works by default !!! Why not Control + A
??
更新:所接受的文本框按Ctrl + A
是的蒙面的文本框,而不是常规的。而在这一点上我与.NET 2.0。但是的我猜的原问题是别的东西,我可以看到按Ctrl + A
.NET 2.0中的代码工作正常,在默认情况下。
Update: The text boxes that accepted Ctrl+A
by default were masked textboxes, not the regular one. And at that point I was with .NET 2.0. But I guess the original problem was something else, as I can see Ctrl+A
working fine by default in .NET 2.0 code.
推荐答案
您可能会寻找的 ShortcutsEnabled 财产。将其设置为真正
将允许您的文本框来实现<大骨节病>控制骨节病> + <大骨节病> A 骨节病>快捷方式(等等)。从文档:
You might be looking for the ShortcutsEnabled property. Setting it to true
would allow your text boxes to implement the Ctrl+A shortcut (among others). From the documentation:
使用的 ShortcutsEnabled
属性
启用或禁用以下
快捷键组合:
Use the
ShortcutsEnabled
property to enable or disable the following shortcut key combinations:
-
<大骨节病> CTRL 骨节病> + <大骨节病>以Z < /骨节病>
CTRL+Z
<大骨节病> CTRL 骨节病> + <大骨节病>电子骨节病>
<大骨节病> CTRL 骨节病> + <大骨节病> C 骨节病>
<大骨节病> CTRL 骨节病> + <大骨节病>是骨节病>
<大骨节病> CTRL 骨节病> + <大骨节病> X 骨节病>
<大骨节病> CTRL 骨节病> + <大骨节病>退格骨节病>
<大骨节病> CTRL 骨节病> + <大骨节病> V 骨节病>
<大骨节病> CTRL 骨节病> + <大骨节病>删除骨节病>
<大骨节病> CTRL 骨节病> + <大骨节病> A 骨节病>
<大骨节病> SHIFT 骨节病> + <大骨节病>删除骨节病>
<大骨节病> CTRL 骨节病> + <大骨节病>→< /骨节病>
CTRL+L
<大骨节病> SHIFT 骨节病> + <大骨节病>插入骨节病>
<大骨节病> CTRL 骨节病> + <大骨节病>研究骨节病>
编辑:结果
然而,的文档规定:
的TextBox 控制不支持<大骨节病> CTRL 骨节病> + <大骨节病> A 骨节病>快捷键的时候多行属性值为true。
The TextBox control does not support the CTRL+A shortcut key when the Multiline property value is true.
您可能将不得不使用 TextBoxBase
等的RichTextBox ,对于工作。
You will probably have to use another subclass of TextBoxBase
, such as RichTextBox, for that to work.
这篇关于为什么有些文本框不接受控制+ A快捷键来选择所有默认的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!