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

后端 未结 9 2468
春和景丽
春和景丽 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:07

    Throwing in my two cents. Calling this under keypress is just another option.

    private void TxtBox_KeyPress(object sender, KeyPressEventArgs e)
    {
        if (e.KeyChar == '\x1')
        {
            TxtBox.SelectAll();
            e.Handled = true;
        }
    }
    

提交回复
热议问题