如何在KeyDown事件上禁用蜂鸣声

如何在KeyDown事件上禁用蜂鸣声

本文介绍了如何在KeyDown事件上禁用蜂鸣声的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在下面列出了我的KeyDown事件代码的一部分。用户按Ctrl + Y可以执行KeyDown事件。但是,完成此操作后,会发出一声我要禁用的哔声。我还将表单的KeyPreview属性设置为True。



我认为e.SuppressKeyPress = True语句会禁用蜂鸣声,但事实并非如此。



当用户按下Ctrl + Y键时,我需要什么声明才能停止发出哔哔声?



I have listed a portion of my KeyDown event code below. The KeyDown event can be executed by the user pressing Ctrl+Y. However, when this is done, there is a beep sound that I want to disable. I have also set the KeyPreview property of the form to True.

I thought the e.SuppressKeyPress = True statement would disable the beep, but it does not.

What statement do I need in order to stop the beep sound when the user presses the Ctrl+Y keys?

Private Sub frmAddEditAssets_KeyDown(sender As Object, e As KeyEventArgs) Handles MyBase.KeyDown
           Case (Keys.Control + Keys.Y)
               e.SuppressKeyPress = True
               Call YearEndUpdate()
       End Select

推荐答案



这篇关于如何在KeyDown事件上禁用蜂鸣声的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-07 07:12