如何在按钮单击中放置警报音

问题描述:

先生,请给出一些逐步解决此问题的方法.

Sir please give some step wise process to solve this problem.

在单击此按钮时尝试播放wav文件.
Try playing a wav file when this button is clicked on.


在点击事件中使用它:

Use this in click event:

SoundPlayer player = new SoundPlayer("file path here");
player.Play();



虽然,如果这是一个Web应用程序,则必须在单击按钮时将声音文件嵌入页面中.



Although, if this is a web application, you will have to embed the sound file in the page on the button click.


保持很简单:

Keep is simple:

System.ConsoleBeep(400, 40);



如果没有控制台,请不要担心-它仍然可以工作(适用于窗口应用程序或其他任何应用程序).

—SA



Don''t be afraid if there is no console — is will work anyway (for windowed application or anything else).

—SA