WPF,这个资源文件路径该怎么写? 右键音乐文件Sound1.wav属性,生成属性改成 嵌入的资源 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 加上new Uri看一下:SoundPlayer player1 = new SoundPlayer(new Uri(s2)); SoundPlayer 没有参数是URI的构造函数 参考: URI Prefix not supportedHow can the MediaElement play WAV file that is part of a Resourcefile?Uri uri = new Uri(@"pack://application:,,,/MyAssembly;component/Sounds/10meters.wav");StreamResourceInfo sri = Application.GetResourceStream(uri);SoundPlayer simpleSound = new SoundPlayer(sri.Stream);simpleSound.Play();SoundPlayer 没有参数是URI的构造函数 string s2 = "pack://application:,,,/aa/Sound1.wav"; SoundPlayer player1 = new SoundPlayer(s2); player1.Play();//或者用绝对路径 SoundPlayer player = new SoundPlayer(); string location = Environment.CurrentDirectory + "\\aa\\Sound1.wav"; player.SoundLocation = location; player.Play(); 请教写入sql的问题 gridview超链接传值 winform中使用datagridview的问题 SqlCommand类初始值设定项初始化类型失败 VS2005编的EXE在WINCE下运行的问题 在WinForm中,如何鼠标双击DataGridView单元格变成ComboBox? 2个库中的2个表关联 如何添加或删除app.config中的内容 一个关于ado.net的疑问 如何创建一个不规则的半透明的窗体 [求助]C#如何实现对文件后缀名的修改 求获取网站里面的post或者GET,实现登陆,发布功能,类似的资料
URI Prefix not supported
How can the MediaElement play WAV file that is part of a Resourcefile?Uri uri = new Uri(@"pack://application:,,,/MyAssembly;component/Sounds/10meters.wav");
StreamResourceInfo sri = Application.GetResourceStream(uri);
SoundPlayer simpleSound = new SoundPlayer(sri.Stream);
simpleSound.Play();
SoundPlayer 没有参数是URI的构造函数
string s2 = "pack://application:,,,/aa/Sound1.wav";
SoundPlayer player1 = new SoundPlayer(s2);
player1.Play();//或者用绝对路径
SoundPlayer player = new SoundPlayer();
string location = Environment.CurrentDirectory + "\\aa\\Sound1.wav";
player.SoundLocation = location;
player.Play();