1. 程式人生 > >每日站立會議 11.20

每日站立會議 11.20

今日工作上一首控制元件的程式碼

private void button5_Click(object sender,System.EventArgs e)
{//停止播放
if(this.axMediaPlayer1.FileName.Length>0)
this.axMediaPlayer1.Stop(); else
{
MessageBox.show("請選擇歌曲","資訊提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
}
private void button6_Click(object sender,System.EventArgs e)
{//上一首歌曲
if(this .listView1.Items.Count>0)
{
if(this.listView1.SelectedItems.Count>0)
{
int ipos=this.listView1.SelectedItems[0].Index;
if(ipos>0)
{
this.listView1.Items[ipos-1].Selected=true;
string         FileName=this.listView1.Items[ipos-1].SubItems[3].Text;
this.axMediaPlayer1.FileName=FileName;
this.axMediaPlayer1.Play();
}
else
{
MessageBox.Show("已經是第一首歌曲!","資訊提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
}
}
else
{
MessageBox.Show("請選擇歌曲","資訊提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
}