码迷,mamicode.com
首页 > 其他好文 > 详细

textbox不支持Ctrl+A

时间:2015-11-02 19:08:46      阅读:269      评论:0      收藏:0      [点我收藏+]

标签:


http://stackoverflow.com/questions/5885739/why-are-some-textboxes-not-accepting-control-a-shortcut-to-select-all-by-defau

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:

Use the ShortcutsEnabled property to enable or disable the following shortcut key combinations:

  • CTRL+Z

  • CTRL+E

  • CTRL+C

  • CTRL+Y

  • CTRL+X

  • CTRL+BACKSPACE

  • CTRL+V

  • CTRL+DELETE

  • CTRL+A

  • SHIFT+DELETE

  • CTRL+L

  • SHIFT+INSERT

  • CTRL+R

EDIT:
However, the documentation states:

The TextBox control does not support the CTRL+A shortcut key when the Multiline property value is true.

You will probably have to use another subclass of TextBoxBase, such as RichTextBox, for that to work.

 

http://stackoverflow.com/questions/16197915/how-can-i-allow-ctrla-with-textbox-in-winform

 Like other answers indicate, Application.EnableVisualStyles() should be called. Also the TextBox.ShortcutsEnabled should be set to true.

But if your TextBox.Multiline is enabled then Ctrl+A will not work (see MSDN documentation). Using RichTextBox instead will get around the problem.

textbox不支持Ctrl+A

标签:

原文地址:http://www.cnblogs.com/chucklu/p/4930696.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!