我想用C#写个播放音乐的软件,写了代码可音乐就是不播放,不知道怎么回事,下面是我的代码,大家看看哪里错了
private void button1_Click(object sender, EventArgs e)//点击按钮添加歌曲放在listBox1里
{ openFileDialog1.InitialDirectory = "D:\\";
openFileDialog1.Filter = "全部文件(*.*)|*.*|mp3(*.mp3)|*.mp3";
openFileDialog1.FilterIndex = 1;
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
listBox1.Items.Add(openFileDialog1.FileName);
music[musiccount++]=s ;
listBox1.Text = s; }
} private void button2_Click(object sender, EventArgs e)//点击按钮播放音乐
{
this .axWindowsMediaPlayer1.Ctlcontrols .play();
}
private void button1_Click(object sender, EventArgs e)//点击按钮添加歌曲放在listBox1里
{ openFileDialog1.InitialDirectory = "D:\\";
openFileDialog1.Filter = "全部文件(*.*)|*.*|mp3(*.mp3)|*.mp3";
openFileDialog1.FilterIndex = 1;
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
listBox1.Items.Add(openFileDialog1.FileName);
music[musiccount++]=s ;
listBox1.Text = s; }
} private void button2_Click(object sender, EventArgs e)//点击按钮播放音乐
{
this .axWindowsMediaPlayer1.Ctlcontrols .play();
}
在哪里定义的?this .axWindowsMediaPlayer1.Ctlcontrols .play();
这个也不对。