c#在KeyDown按下时避免发出哔哔声?

时间:2014-09-27 09:47:29

标签: audio click keydown beep

在文本框中按Enter键时,我在删除哔声时遇到问题。

这不起作用:

private void textBox3_KeyDown(object sender, KeyEventArgs e)
    {

        if (e.KeyCode == Keys.Enter)
        {
            e.SuppressKeyPress = true;
            button1.PerformClick();               
        }

    }

1 个答案:

答案 0 :(得分:0)

我找到了答案!

 private void textBox2_KeyDown(object sender, KeyEventArgs e)
        {
            //Pressing ENTER
            if (e.KeyCode == Keys.Enter)
            {
                button1.Select();
                e.SuppressKeyPress = true;
                SendKeys.Send("{ENTER}");            
            }

        }