在 C# WPF 中发出哔哔声
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24356466/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Making A Beep in C# WPF
提问by N.I.R.E.X
Is there any ways to make a beep sound in C# WPF ?
有没有办法在 C# WPF 中发出哔哔声?
I've been looking for WPF beeping , but all I could find was Beeping in normal windows form.
我一直在寻找 WPF beeping ,但我能找到的只是普通窗口形式的 Beeping 。
回答by Frement
You can make a "beep" sound using:
您可以使用以下方法发出“哔”声:
SystemSounds.Beep.Play();
回答by Saverio Terracciano
// Plays the sound associated with the Beep system event.
SystemSounds.Beep.Play();
This works in WPF (http://msdn.microsoft.com/en-us/library/system.media.systemsounds.beep(v=vs.110).aspx)
这适用于 WPF ( http://msdn.microsoft.com/en-us/library/system.media.systemsounds.beep(v=vs.110).aspx)
回答by Babak.Abad
You can play any thing:
你可以玩任何东西:
SoundPlayer snd = new SoundPlayer(filePath);
snd.Play();

