[英]SoundPlayer not working when visual studio application is published
当我在 Microsoft Visual Studio 中运行时,声音有效。 然而,在我发表之后,声音确实有效。 声音属性设置为内容。 有人可以帮忙吗? 谢谢
private void InitializeSound()
{
// Create an instance of the SoundPlayer class.
player = new SoundPlayer(@"Sounds\sirenpolice3.wav");
}
试试这个样本
using (var player = new SoundPlayer(@"Sounds\sirenpolice3.wav"))
{
// Use PlaySync to load and then play the sound.
// ... The program will pause until the sound is complete.
player.PlaySync();
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.