简体   繁体   English

如何在WPF中播放声音?

[英]How To Play Sound In WPF?

I developing the game "minesweeper" ( Wiki ), and I want to play sound when the user hit a bomb. 我开发了“ minesweeper”( 维基 )游戏,我想在用户炸弹时播放声音。 How can I play a sound while the application is running? 在应用程序运行时如何播放声音?

Thank you for help 谢谢你的帮助

You can use WPF's MediaElement for this. 您可以为此使用WPF的MediaElement。 For more information, visit the official documentation: https://msdn.microsoft.com/en-us/library/system.windows.controls.mediaelement(v=vs.100).aspx 有关更多信息,请访问官方文档: https : //msdn.microsoft.com/zh-cn/library/system.windows.controls.mediaelement(v=vs.100).aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM