诺基亚N8音乐播放器怎么用?


 发布时间:2020-12-04 00:07:18

直接给你个代码吧!using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.IO; namespace MP3File { public partial class frmMain : Form { public frmMain() { InitializeComponent(); } /// /// 浏览MP3文件 /// /// /// private void btn_Open_Click(object sender, EventArgs e) { if (this.oFDlog_Info.ShowDialog() == DialogResult.OK) { this.lV_Info.Items.Clear(); string[] FileNames = this.oFDlog_Info.FileNames; foreach (string FileName in FileNames) { //取得文件大小 FileInfo FileInfo = new FileInfo(FileName); float FileSize = (float)FileInfo.Length / (1024 * 1024); this.axMP_Info.FileName = FileName; //取得作者信息 string Author = this.axMP_Info.GetMediaInfoString(MediaPlayer.MPMediaInfoType.mpClipAuthor); //取得不含路径的文件名 string ShortFileName = FileName.Substring(FileName.LastIndexOf("\\") + 1); ShortFileName = ShortFileName.Substring(0, ShortFileName.Length - 4); //填充歌曲列表 string[] SubItem ={ ShortFileName, Author, FileSize.ToString().Substring(0, 4) + "M", FileName }; ListViewItem Item = new ListViewItem(SubItem); this.lV_Info.Items.Add(Item); this.lV_Info.Items[0].Selected = true; } } } /// /// 播放MP3文件 /// /// /// private void btn_Play_Click(object sender, EventArgs e) { if (this.lV_Info.Items.Count > 0) { if (this.lV_Info.SelectedItems.Count > 0) { int iPos = this.lV_Info.SelectedItems[0].Index; string FileName = this.lV_Info.Items[iPos].SubItems[3].Text.ToString(); this.axMP_Info.FileName = FileName; this.axMP_Info.Play(); } } else { MessageBox.Show("请选择歌曲!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } /// /// 暂停播放 /// /// /// private void btn_Pase_Click(object sender, EventArgs e) { if (this.axMP_Info.FileName.Length > 0) this.axMP_Info.Pause(); else { MessageBox.Show("请选择歌曲!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } /// /// 上一首歌曲 /// /// /// private void btn_Pre_Click(object sender, EventArgs e) { if (this.lV_Info.Items.Count > 0) { if (this.lV_Info.SelectedItems.Count > 0) { int iPos = this.lV_Info.SelectedItems[0].Index; if (iPos > 0) { this.lV_Info.Items[iPos - 1].Selected = true; string FileName = this.lV_Info.Items[iPos - 1].SubItems[3].Text.ToString(); this.axMP_Info.FileName = FileName; this.axMP_Info.Play(); } else { MessageBox.Show("已经是第一首歌曲!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } else { MessageBox.Show("请选择歌曲!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } /// /// 下一首歌曲 /// /// /// private void btn_Next_Click(object sender, EventArgs e) { if (this.lV_Info.Items.Count > 0) { if (this.lV_Info.SelectedItems.Count > 0) { int iPos = this.lV_Info.SelectedItems[0].Index; if (iPos < this.lV_Info.Items.Count - 1) { this.lV_Info.Items[iPos + 1].Selected = true; string FileName = this.lV_Info.Items[iPos + 1].SubItems[3].Text.ToString(); this.axMP_Info.FileName = FileName; this.axMP_Info.Play(); } else { MessageBox.Show("已经是最后一首歌曲!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } else { MessageBox.Show("请选择歌曲!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } /// /// 停止播放 /// /// /// private void btn_Stop_Click(object sender, EventArgs e) { if (this.axMP_Info.FileName.Length > 0) this.axMP_Info.Stop(); else { MessageBox.Show("请选择歌曲!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } } 详细情况 可以留言!。

播放器 自带 手机

上一篇: 怎样用酷狗音乐2011下载音乐

下一篇: 求一个三人的日本女子组合



发表评论:
相关阅读
热点话题
网站首页 |网站地图

Copyright © 2012-2020 鸟语歌曲网 版权所有 1.05727