还是不行啊我的做的应用程序就是一个简单的窗体,然后在里面加一个按钮,点一下按钮,出现一个声音。 声音我发的位置是:H:\加声音\WindowsApplication4\goodmusic\q.wav我的代码如下 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Media;namespace WindowsApplication4 { public partial class Form1 : Form { public Form1() { InitializeComponent(); }
声音我发的位置是:H:\加声音\WindowsApplication4\goodmusic\q.wav我的代码如下
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Media;namespace WindowsApplication4
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
//SoundPlayer sp =new SoundPlayer("H:\\加声音\\WindowsApplication4\\goodmusic\\q.wav");//这个是绝对地址,可以运行
//------------------------------------------------------------------
SoundPlayer sp = new SoundPlayer(@"../加声音/WindowsApplication4/goodmusic/q.wav");//这个是相对地址,找不到哎,请大家帮忙解决!!
sp.Play();
}
}
}
试试相对路径:@"goodmusic\q.wav"