How can I allow ctrl+a with TextBox in winform?

后端 未结 9 2458
春和景丽
春和景丽 2020-12-15 02:38

I\'m asking the question already asked (and even answered) here: Why are some textboxes not accepting Control + A shortcut to select all by default

But that answer d

9条回答
  •  轮回少年
    2020-12-15 03:17

    Quick answer is that if you are using multiline true you have to explicitly call the select all.

    private void tbUsername_KeyDown(object sender, KeyEventArgs e)
    {
        if (e.KeyCode == Keys.A && e.Control)
        {
            tbUsername.SelectAll();
        }
    }
    

提交回复
热议问题