Stop the Bell on CTRL-A (WinForms)

后端 未结 4 1291
野性不改
野性不改 2021-01-17 10:59

Any ideas how to stop the system bell from sounding when CTRL-A is used to select text in a Winforms application?

Here\'s the problem. Create a

4条回答
  •  有刺的猬
    2021-01-17 11:24

        private void textBox1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Control && e.KeyCode == Keys.A)
            {
                this.textBox1.SelectAll();
                e.SuppressKeyPress = true;
            }
        }
    

    hope this helps

提交回复
热议问题