使用C#播放声音中的WinForms [英] Playing sounds in Winforms using C#
本文介绍了使用C#播放声音中的WinForms的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在C#中播放声音警示某些事件/触发发生。
I want to play a warning sound in C# when some event / trigger occurs.
如何在发挥WinForms的声音,你怎么可以调整音量等?
How are sounds played in WinForms and how can you adjust the volume etc?
推荐答案
有关播放声音干脆,没有互动,你可以使用System.Media.SoundPlayer:
For playing sound simply, with no interaction you can use System.Media.SoundPlayer:
System.Media.SoundPlayer player = new System.Media.SoundPlayer();
player.SoundLocation = "soundFile.wav";
player.Play();
这篇关于使用C#播放声音中的WinForms的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文