Why are some textboxes not accepting Control + A shortcut to select all by default

后端 未结 5 1204
野趣味
野趣味 2020-12-08 10:05

I have found a few textboxes here and there in my program that accepts Control+A shortcut to select the entire text \"by default\" with \"no coding\".

I don\'t know

5条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-08 10:14

    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

    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.

提交回复
热议问题