用C++编写音乐播放器
C#写的一个简单播放器

using System;using System.Collections.Generic;using ponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.IO;using WMPLib;namespace播放器{public partial class Form1 : Form{IWMPMediaCollection mediacollection;IWMPMedia media;public Form1(){InitializeComponent();}//添加文件的方法private void AddFile(string path){string songname = path.Substring(stIndexOf("\\") + 1);songname = songname.Substring(0, songname.Length - 4);//查看lstBox是否已存在要添加的歌曲不存在才继续添加for (int i = 0; i < lstPPName.Items.Count; i++){if (lstPPName.Items[i].ToString() == songname){return;}}mediacollection = WMPlayer.mediaCollection;media = mediacollection.add(path);WMPlayer.currentPlaylist.appendItem(media);mediacollection.remove(media, false);//可省lstPPName.Items.Add(songname);}//查找文件的方法private void SearchFile(string path){DirectoryInfo dirInfo = new DirectoryInfo(path);foreach (FileInfo f in dirInfo.GetFiles("*.mp3")){this.AddFile(f.FullName);}}private void打开ToolStripMenuItem_Click(object sender, EventArgs e){try{DialogResult result = openFD.ShowDialog();if (result == DialogResult.OK){//songname为选择的歌名string songname = openFD.FileName.Substring(stIndexOf("\\") + 1); songname = songname.Substring(0, songname.Length - 4);//清空当前播放列表WMPlayer.currentPlaylist.clear();//同步LstBoxlstPPName.Items.Clear();this.Text = songname + "--播放器(C#版)";lstPPName.Items.Add(songname);//播放当前打开的曲目WMPlayer.URL = openFD.FileName;WMPlayer.Ctlcontrols.play();}}catch (Exception error){MessageBox.Show(error.Message.ToString());}}private void退出ToolStripMenuItem_Click(object sender, System.EventArgs e){Application.Exit();}private void添加单个文件ToolStripMenuItem_Click(object sender, System.EventArgs e){try{DialogResult result = openFD.ShowDialog();if (result == DialogResult.OK){//调用已定义好添加文件的方法this.AddFile(openFD.FileName);}}catch (Exception error){MessageBox.Show(error.Message.ToString());}}private void搜索文件夹ToolStripMenuItem_Click(object sender, System.EventArgs e){DialogResult result = folderBD.ShowDialog();if (result == DialogResult.OK){//调用已定义好查找文件的方法this.SearchFile(folderBD.SelectedPath);}}private void播放暂停ToolStripMenuItem_Click(object sender, System.EventArgs e){try{if (WMPlayer.playState == WMPPlayState.wmppsPaused) {WMPlayer.Ctlcontrols.play();}else{WMPlayer.Ctlcontrols.pause();}}catch (Exception error){MessageBox.Show(error.Message.ToString());}}private void上一首ToolStripMenuItem_Click(object sender, System.EventArgs e){try{WMPlayer.Ctlcontrols.previous();}catch (Exception error){MessageBox.Show(error.Message.ToString());}}private void下一首ToolStripMenuItem_Click(object sender, System.EventArgs e){try{WMPlayer.Ctlcontrols.next();}catch (Exception error){MessageBox.Show(error.Message.ToString());}}private void播放ToolStripMenuItem1_Click(object sender,System.EventArgs e){try{if (lstPPName.SelectedIndex > -1){IWMPMedia nowmedia = WMPlayer.currentPlaylist.get_Item(lstPPName.SelectedIndex);WMPlayer.Ctlcontrols.playItem(nowmedia);}}catch (Exception error){MessageBox.Show(error.Message.ToString());}}private void上移ToolStripMenuItem_Click(object sender, System.EventArgs e){try{if (lstPPName.SelectedIndex > -1){//上移lstBox中选中的项int select = lstPPName.SelectedIndex;lstPPName.Items.Insert(select + 1, lstPPName.Items[select - 1]);lstPPName.Items.Remove(lstPPName.Items[select - 1]);//同步上移播放列表中的项WMPlayer.currentPlaylist.moveItem(select, select - 1);//清空选择lstPPName.ClearSelected();}}catch (Exception error){MessageBox.Show(error.Message.ToString());}}private void下移ToolStripMenuItem_Click(object sender, System.EventArgs e){try{if (lstPPName.SelectedIndex > -1){//select记录选择项的位置int select = lstPPName.SelectedIndex;//下移listBox中选择的项lstPPName.Items.Insert(select + 2, lstPPName.SelectedItem);lstPPName.Items.Remove(lstPPName.Items[select]);//同步下移播放列表中的项WMPlayer.currentPlaylist.moveItem(select, select + 1);}}catch (Exception error){MessageBox.Show(error.Message.ToString());}}private void删除ToolStripMenuItem_Click(object sender, System.EventArgs e){try{if (lstPPName.SelectedIndex > -1){//select记录选择项的位置int select = lstPPName.SelectedIndex;//删除lstBox对应的项lstPPName.Items.Remove(lstPPName.SelectedItem);//同步播放列表WMPlayer.currentPlaylist.removeItem(WMPlayer.currentPlaylist.get_I tem(select));}}catch (Exception error){MessageBox.Show(error.StackTrace.ToString());}}private void清空ToolStripMenuItem_Click(object sender, System.EventArgs e){//selectCount记载当前播放列表共有多少项int selectCount = lstPPName.Items.Count;//清空lstBox中的所有项lstPPName.Items.Clear();//同步播放列表WMPlayer.currentPlaylist.clear();}private void lstPPName_SelectedIndexChanged(object sender, EventArgs e){if (lstPPName.SelectedIndex < 0){播放ToolStripMenuItem.Enabled = false;上移ToolStripMenuItem.Enabled = false;下移ToolStripMenuItem.Enabled = false;删除ToolStripMenuItem.Enabled = false;}else{播放ToolStripMenuItem.Enabled = true;上移ToolStripMenuItem.Enabled = true;下移ToolStripMenuItem.Enabled = true;删除ToolStripMenuItem.Enabled = true;}//如果选择为第一条可以禁用上移按钮否则启用if (lstPPName.SelectedIndex == 0)上移ToolStripMenuItem.Enabled = false;else上移ToolStripMenuItem.Enabled = true;//如果选择为最后一条可以禁用下移按钮否则启用if (lstPPName.SelectedIndex == lstPPName.Items.Count - 1)下移ToolStripMenuItem.Enabled = false;else下移ToolStripMenuItem.Enabled = true;//如果无任何选择则禁用上下移菜单if (lstPPName.SelectedIndex < 0){上移ToolStripMenuItem.Enabled = false;下移ToolStripMenuItem.Enabled = false;}}private void WMPlayer_CurrentItemChange(object sender, AxWMPLib._WMPOCXEvents_CurrentItemChangeEvent e){string url = WMPlayer.currentMedia.sourceURL;string songname = url.Substring(stIndexOf("\\") + 1);songname = songname.Substring(0, songname.Length - 4);//同步更换标题this.Text = songname + "--播放器(C#版)";}private void lstPPName_DoubleClick(object sender, EventArgs e){IWMPMedia nowmedia = WMPlayer.currentPlaylist.get_Item(lstPPName.SelectedIndex);WMPlayer.Ctlcontrols.playItem(nowmedia);}}}。
C#程序自作音乐视频播放器

一个简单的音乐视频系统建立一个项目:代码:点击窗体进入using System;using System.Collections.Generic;using ponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.IO;namespace Windows音乐播放器{public partial class Form1 : Form{public Form1(){InitializeComponent();}string[] fileList = new string[10000]; // 定义播放列表数的最大值int numOfMusic; // 选中的媒体文件的索引号int selectOne; // 选中的音乐文件bool playOne = false; // 控制是否循环播放public void AddFile(string path){if (numOfMusic < 10000){numOfMusic += 1;fileList[numOfMusic] = path;}else{MessageBox.Show("不能添加文件!", "播放列表已满");}}public void AddFiles(string path, ListBox lstFiles){DirectoryInfo dir = new DirectoryInfo(path);foreach (FileInfo f in dir.GetFiles("*.mp3")){AddFile(f.FullName);int i;string strFile = Convert.ToString(numOfMusic);for (i = 1; i <= 5 - strFile.Length; i++){strFile += "";}strFile = ;lstFileList.Items.Add(strFile);}foreach (DirectoryInfo d in dir.GetDirectories()){AddFiles(d.FullName, lstFileList);}}public void DelFile(int selectNum){int i;for (i = selectNum; i <= numOfMusic - 1; i++){fileList[i] = fileList[i + 1];}numOfMusic -= 1;}public void CloseBtn(){btnPlay.Enabled = false;btnBack.Enabled = false;btnForward.Enabled = false;btnStop.Enabled = false;btnReplay.Enabled = false;btnDelete.Enabled = false;}private void Form1_Load(object sender, EventArgs e){lstFileList.Items.CopyTo(fileList, 0);// 将列表框(lstFileList)中的列表项全部复制到数组(fileList)中numOfMusic = 0; // 选中第一个媒体文件CloseBtn();}public void Play(int selectNum){mediaPlayer.URL = fileList[selectNum]; // 播放选中的媒体文件this.Text = "正在播放-- " + lstFileList.SelectedItem.ToString();}public void OpenBtn(){btnPlay.Enabled = true;btnBack.Enabled = true;btnForward.Enabled = true;}private void axWindowsMediaPlayer1_Enter(object sender, EventArgs e){}private void butAddFile_Click(object sender, EventArgs e){int i;odlgMedia.FileName = ""; // 设置默认文件名odlgMedia.InitialDirectory = "C:\\"; // 设置默认路径odlgMedia.Filter = "mp3文件|*.mp3|所有文件|*.*"; // 设置文件类型if (odlgMedia.ShowDialog() == DialogResult.OK){string path = odlgMedia.FileName;FileInfo f = new FileInfo(path);AddFile(f.FullName);string strFile = Convert.ToString(numOfMusic);for (i = 1; i <= 5 - strFile.Length; i++){strFile += "";}strFile = ;lstFileList.Items.Add(strFile);if (lstFileList.Items.Count > 0){OpenBtn();}}}private void btnAddFiles_Click(object sender, EventArgs e){F.SelectedPath = "c:\\";fbdlaMedia.ShowNewFolderButton = true;fbdlaMedia.Description = "请选择媒体文件目录:";fbdlaMedia.ShowNewFolderButton = false;if (fbdlaMedia.ShowDialog() == DialogResult.OK){AddFiles(fbdlaMedia.SelectedPath, lstFileList);if (lstFileList.Items.Count > 0){OpenBtn();}}}private void btnDelete_Click(object sender, EventArgs e){int i = lstFileList.SelectedIndex;if (lstFileList.SelectedIndex >= 0){if ((selectOne == lstFileList.SelectedIndex + 1) && (mediaPlayer.URL != "")){MessageBox.Show("不能删除正在播放的文件", "错误");}else{DelFile(i + 1);lstFileList.Items.RemoveAt(i);if (i < lstFileList.Items.Count){lstFileList.SelectedIndex = i;}else if (lstFileList.Items.Count == 0){CloseBtn();}else{lstFileList.SelectedIndex = 0;}}}}private void btnPlay_Click(object sender, EventArgs e){if (lstFileList.SelectedIndex < 0){selectOne = 1;lstFileList.SelectedIndex = 0;}else{selectOne = lstFileList.SelectedIndex + 1;}Play(selectOne);tmrMedia.Enabled = true;btnStop.Enabled = true;btnReplay.Enabled = true;}private void lstFileList_SelectedIndexChanged(object sender, EventArgs e) {btnDelete.Enabled = true;}private void btnBack_Click(object sender, EventArgs e){if (lstFileList.SelectedIndex > 0){lstFileList.SelectedIndex -= 1;}else if (lstFileList.SelectedIndex == 0){lstFileList.SelectedIndex = lstFileList.Items.Count - 1;}else{lstFileList.SelectedIndex = numOfMusic - 1;}selectOne = lstFileList.SelectedIndex + 1;Play(selectOne);btnStop.Enabled = true;btnReplay.Enabled = true;}private void btnForward_Click(object sender, EventArgs e){if (lstFileList.SelectedIndex < lstFileList.Items.Count - 1){lstFileList.SelectedIndex = lstFileList.SelectedIndex + 1;}else{if (lstFileList.SelectedIndex > 0){lstFileList.SelectedIndex = 0;}}selectOne = lstFileList.SelectedIndex + 1;Play(selectOne);btnStop.Enabled = true;btnReplay.Enabled = true;}private void btnStop_Click(object sender, EventArgs e){mediaPlayer.URL = "";this.Text = "媒体播放器";tmrMedia.Enabled = false;btnReplay.Enabled = false;lstFileList.SelectedIndex = selectOne - 1;}private void btnReplay_Click(object sender, EventArgs e){if (playOne == true){playOne = false;btnReplay.FlatStyle = FlatStyle.Standard; // 设置按钮外观为三维btnReplay.Text = "单曲循环";}else{playOne = true;btnReplay.FlatStyle = FlatStyle.Popup; // 设置按钮外观为平面显示btnReplay.Text = "取消循环";}lstFileList.SelectedIndex = selectOne - 1;}private void lstFileList_DoubleClick(object sender, EventArgs e){// 双击播放列表中的媒体文件时,则播放该文件btnPlay_Click(sender, e);playOne = false;btnReplay.Text = "单曲循环";}private void tmrMedia_Tick(object sender, EventArgs e){// 用Timer控件控制连续播放if (mediaPlayer.playState == WMPLib.WMPPlayState.wmppsStopped){if (playOne == false){if (selectOne < lstFileList.Items.Count){selectOne += 1;}else if (selectOne == lstFileList.Items.Count){// 如果列表中所有媒体文件都播放完毕,则从头开始。
单片机_音乐播放的c代码

单片机音乐播放的c代码#include "reg52.h"unsigned char Count;sbit _Speak =P2^3 ; //讯响器控制脚unsigned char code SONG[] ={ //祝你平安0x26,0x20,0x20,0x20,0x20,0x20,0x26,0x10,0x20,0x10,0x20,0x80,0x26,0x20,0x30,0x20, 0x30,0x20,0x39,0x10,0x30,0x10,0x30,0x80,0x26,0x20,0x20,0x20,0x20,0x20,0x1c,0x20, 0x20,0x80,0x2b,0x20,0x26,0x20,0x20,0x20,0x2b,0x10,0x26,0x10,0x2b,0x80,0x26,0x20, 0x30,0x20,0x30,0x20,0x39,0x10,0x26,0x10,0x26,0x60,0x40,0x10,0x39,0x10,0x26,0x20, 0x30,0x20,0x30,0x20,0x39,0x10,0x26,0x10,0x26,0x80,0x26,0x20,0x2b,0x10,0x2b,0x10, 0x2b,0x20,0x30,0x10,0x39,0x10,0x26,0x10,0x2b,0x10,0x2b,0x20,0x2b,0x40,0x40,0x20, 0x20,0x10,0x20,0x10,0x2b,0x10,0x26,0x30,0x30,0x80,0x18,0x20,0x18,0x20,0x26,0x20, 0x20,0x20,0x20,0x40,0x26,0x20,0x2b,0x20,0x30,0x20,0x30,0x20,0x1c,0x20,0x20,0x20, 0x20,0x80,0x1c,0x20,0x1c,0x20,0x1c,0x20,0x30,0x20,0x30,0x60,0x39,0x10,0x30,0x10, 0x20,0x20,0x2b,0x10,0x26,0x10,0x2b,0x10,0x26,0x10,0x26,0x10,0x2b,0x10,0x2b,0x80, 0x18,0x20,0x18,0x20,0x26,0x20,0x20,0x20,0x20,0x60,0x26,0x10,0x2b,0x20,0x30,0x20, 0x30,0x20,0x1c,0x20,0x20,0x20,0x20,0x80,0x26,0x20,0x30,0x10,0x30,0x10,0x30,0x20, 0x39,0x20,0x26,0x10,0x2b,0x10,0x2b,0x20,0x2b,0x40,0x40,0x10,0x40,0x10,0x20,0x10, 0x20,0x10,0x2b,0x10,0x26,0x30,0x30,0x80,0x00,//路边的野华不要采0x30,0x1C,0x10,0x20,0x40,0x1C,0x10,0x18,0x10,0x20,0x10,0x1C,0x10,0x18,0x40,0x1C ,0x20,0x20,0x20,0x1C,0x20,0x18,0x20,0x20,0x80,0xFF,0x20,0x30,0x1C,0x10,0x18,0x20 ,0x15,0x20,0x1C,0x20,0x20,0x20,0x26,0x40,0x20,0x20,0x2B,0x20,0x26,0x20,0x20,0x20, 0x30,0x80,0xFF,0x20,0x20,0x1C,0x10,0x18,0x10,0x20,0x20,0x26,0x20,0x2B,0x20,0x30, 0x20,0x2B,0x40,0x20,0x20,0x1C,0x10,0x18,0x10,0x20,0x20,0x26,0x20,0x2B,0x20,0x30, 0x20,0x2B,0x40,0x20,0x30,0x1C,0x10,0x18,0x20,0x15,0x20,0x1C,0x20,0x20,0x20,0x26 ,0x40,0x20,0x20,0x2B,0x20,0x26,0x20,0x20,0x20,0x30,0x80,0x20,0x30,0x1C,0x10,0x20, 0x10,0x1C,0x10,0x20,0x20,0x26,0x20,0x2B,0x20,0x30,0x20,0x2B,0x40,0x20,0x15,0x1F ,0x05,0x20,0x10,0x1C,0x10,0x20,0x20,0x26,0x20,0x2B,0x20,0x30,0x20,0x2B,0x40,0x20, 0x30,0x1C,0x10,0x18,0x20,0x15,0x20,0x1C,0x20,0x20,0x20,0x26,0x40,0x20,0x20,0x2B ,0x20,0x26,0x20,0x20,0x20,0x30,0x30,0x20,0x30,0x1C,0x10,0x18,0x40,0x1C,0x20,0x20, 0x20,0x26,0x40,0x13,0x60,0x18,0x20,0x15,0x40,0x13,0x40,0x18,0x80,0x00,};void Time0_Init(){TMOD = 0x01;IE = 0x82;TH0 = 0xD8;TL0 = 0xEF; //12MZ晶振,10ms}void Time0_Int() interrupt 1{TH0 = 0xD8;TL0 = 0xEF;Count++; //长度加1}/*-------------------------------------------------功能:1MS延时子程序-------------------------------------------------*/void Delay_xMs(unsigned int x){unsigned int i,j;for( i =0;i < x;i++ ){for( j =0;j<3;j++ );}}/*-------------------------------------------------功能:歌曲播放子程序i为播放哪一段曲目-------------------------------------------------*/void Play_Song(unsigned char i){unsigned char Temp1,Temp2;unsigned int Addr;Count = 0; //中断计数器清0Addr = i * 217;while(1){Temp1 = SONG[Addr++];if ( Temp1 == 0xFF ) //休止符{TR0 = 0;Delay_xMs(100);}else if ( Temp1 == 0x00 ) //歌曲结束符{return;}else{Temp2 = SONG[Addr++];TR0 = 1;while(1){_Speak = ~_Speak;Delay_xMs(Temp1);if ( Temp2 == Count ){Count = 0;break;}}}}}/*-------------------------------------------------功能:主程序-------------------------------------------------*/void main(){Time0_Init(); //定时器0中断初始化while(1){Play_Song(0); //播放}}6回答者:小崔凡凡- 二级2009-10-16 21:47我来评论>>提问者对于答案的评价:谢谢!相关内容• 单片机播放音乐里的音乐代码是怎么得到的?有什么软件能将歌曲直接转换成16进制代码 4 2008-11-14• 给个单片机C语言编的音乐程序,能够播放音乐 6 2009-7-22• 求用c语言编写的播放背景音乐的代码 5 2009-6-12• 单片机音乐代码问题 2009-9-28• 单片机音乐代码 5 2009-5-18更多相关问题>>查看同主题问题:单片机音乐音乐播放播放代码等待您来回答∙nokia 3100c音乐播放器如何跟新∙为什么用酷我音乐盒听歌后那歌会在C:\ProgramData\mcache里面呢∙深圳龙华天龙大道珍藏版狂嗨现场dj明仔vs女mc小黎茂名细飞11分钟半时候的那音乐谁知道叫什么名字!∙夏普9020c合上盖子怎么听音乐?∙C:Documents and SettingsAdministrator「开始」菜单酷我音乐盒2010.lnk∙nokia 2600c手机可以用什么音乐播放器?∙『windows』在网页制作中,下列不是背景音乐格式的是那一个?A.tem B mp3 C wav D∙3110c播放音乐时会卡,之后会自动到下一首,怎么办?其他回答共3 条我的博客上有三首连放的,你只要加两首就行了。
1C#写音乐播放器,附带个人代码和控件使用说明

Windows Media Player控件研究我的那个定时提醒程序中要用到它,初步使用问题已解决。
基本使用步骤如下:一、往控件箱中添加此控件:wmp.dll二、往窗体上拖控件三、wmp.URL=XXXX;wmp.play()即可。
平常应用就这三步就OK了。
但是,我想写个播放器的话,就遇到了一些问题。
在dotnet中使用非基于dotnet的控件,需要做一些额外的事,不过这些事vs 已经帮我们做好了,当我们拖了此控件进窗体时,vs会自动调用AxImp.exe,用它根据原有的dll或ocx生成一个用AxHost类包装的新的一组程序集(更为精确的描述见msdn),于是根据WMPLib.dll生成两个文件:AxInterop.WMPLib.dll、Interop.WMPLib.dll。
这两个文件中包含了转化后的类。
包装后的控件继承自System.Windows.Forms.AxHost。
这是第一个问题,控件怎么使用呢?如果是拖控件,很简单,无论如何都能有效的使用。
但是,如果手工new创建控件的实例呢?那就不一定了。
我做过种种实验,获得如下的结论:在非可视化类中无法创建有UI的控件的实例,或者是在没有把实例加入到一个可视化的容器中时。
我实验了下面的代码:AxWMPLib.AxWindowsMediaPlayer wmp=new AxWMPLib.AxWindowsMediaPlayer();this.Controls.Add(wmp);wmp.URL="约定.mp3";wmp.Ctlcontrols.play();这几行代码不一定能运行。
发现,如果这几行代码写在窗体的构造函数中,哪怕show出来都不能运行,只有写在Load或Load之后的事件中,并且把窗体show出来才有运行,否则会抛出一个错误:引发类型为“System.Windows.Forms.AxHost+InvalidActiveXStateException”的异常。
C# WinForm 音乐播放器

目前网络上很多C#做的音乐播放器,但是功能不尽人意。
本人通过网上的播放器源码结合自身的知识做出一个比较好的播放器,供大家交流。
如图:以下是播放器界面代码,新建一个项目CmTTPlayer,窗体文件名为Frm;namespace CmTTPlayer{partial class Frm{////// 必需的设计器变量。
///private ponentModel.IContainer components = null;////// 清理所有正在使用的资源。
////// 如果应释放托管资源,为true;否则为false。
protected override void Dispose(bool disposing){if (disposing && (components != null)){components.Dispose();}base.Dispose(disposing);}#region Windows 窗体设计器生成的代码////// 设计器支持所需的方法- 不要/// 使用代码编辑器修改此方法的内容。
///private void InitializeComponent(){ponents = new ponentModel.Container();ponentResourceManager resources = new ponentResourceManager(typeof(Frm));this.ribbonClientPanel1 = new DevComponents.DotNetBar.Ribbon.RibbonClientPanel();this.slider1 = new DevComponents.DotNetBar.Controls.Slider();this.tabControl1 = new DevComponents.DotNetBar.TabControl();this.tabControlPanel3 = new DevComponents.DotNetBar.TabControlPanel();this.lvMusicList = new System.Windows.Forms.ListView();this.columnHeader1 = new System.Windows.Forms.ColumnHeader();this.columnHeader2 = new System.Windows.Forms.ColumnHeader();this.columnHeader3 = new System.Windows.Forms.ColumnHeader();this.tabItem3 = new DevComponents.DotNetBar.TabItem(ponents);this.tabControlPanel1 = new DevComponents.DotNetBar.TabControlPanel();this.tabItem1 = new DevComponents.DotNetBar.TabItem(ponents);this.tabControlPanel2 = new DevComponents.DotNetBar.TabControlPanel();this.tabItem2 = new DevComponents.DotNetBar.TabItem(ponents);this.statusStrip1 = new System.Windows.Forms.StatusStrip();this.toolStripDropDownButton1 = new System.Windows.Forms.ToolStripDropDownButton();this.tsmiOpenMusic = new System.Windows.Forms.ToolStripMenuItem();this.tsmiOpenFolderMusic = new System.Windows.Forms.ToolStripMenuItem();this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator();this.tsmiOpenUrlMusic = new System.Windows.Forms.ToolStripMenuItem();this.toolStripDropDownButton2 = new System.Windows.Forms.ToolStripDropDownButton();this.panel2 = new System.Windows.Forms.Panel();this.btnPre = new DevComponents.DotNetBar.ButtonX();this.btnLast = new DevComponents.DotNetBar.ButtonX();this.btnPlayOrPause = new DevComponents.DotNetBar.ButtonX();this.btnStop = new DevComponents.DotNetBar.ButtonX();this.pnlTop = new System.Windows.Forms.Panel();this.lblMin = new bel();this.lblExit = new bel();this.progressBarX1 = new DevComponents.DotNetBar.Controls.ProgressBarX();this.chkAudioOnOff = new System.Windows.Forms.CheckBox();this.lblCurrentPosition = new bel();this.lblDuration = new bel();this.lblMusicName = new bel();this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(ponents);this.tsmenuDeleteChangeMusic = new System.Windows.Forms.ToolStripMenuItem();this.删除重复歌曲ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();this.toolStripMenuItem4 = new System.Windows.Forms.ToolStripSeparator();this.tsmenuClearList = new System.Windows.Forms.ToolStripMenuItem();this.timer1 = new System.Windows.Forms.Timer(ponents);this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(ponents);this.ribbonClientPanel1.SuspendLayout();((ponentModel.ISupportInitialize)(this.tabControl1)).BeginInit();this.tabControl1.SuspendLayout();this.tabControlPanel3.SuspendLayout();this.statusStrip1.SuspendLayout();this.panel2.SuspendLayout();this.pnlTop.SuspendLayout();this.contextMenuStrip1.SuspendLayout();this.SuspendLayout();this.ribbonClientPanel1.CanvasColor = System.Drawing.SystemColors.Control;this.ribbonClientPanel1.Controls.Add(this.slider1);this.ribbonClientPanel1.Controls.Add(this.tabControl1);this.ribbonClientPanel1.Controls.Add(this.statusStrip1);this.ribbonClientPanel1.Controls.Add(this.panel2);this.ribbonClientPanel1.Controls.Add(this.pnlTop);this.ribbonClientPanel1.Dock = System.Windows.Forms.DockStyle.Fill;this.ribbonClientPanel1.Location = new System.Drawing.Point(0, 0); = "ribbonClientPanel1";this.ribbonClientPanel1.Size = new System.Drawing.Size(298, 545);this.ribbonClientPanel1.Style.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2;this.ribbonClientPanel1.Style.BackColorGradientAngle = 90;this.ribbonClientPanel1.Style.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground;this.ribbonClientPanel1.Style.BackgroundImagePosition = DevComponents.DotNetBar.eStyleBackgroundImage.Tile;this.ribbonClientPanel1.Style.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid;this.ribbonClientPanel1.Style.BorderBottomWidth = 1;this.ribbonClientPanel1.Style.BorderColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder;this.ribbonClientPanel1.Style.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid;this.ribbonClientPanel1.Style.BorderLeftWidth = 1;this.ribbonClientPanel1.Style.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid;this.ribbonClientPanel1.Style.BorderRightWidth = 1;this.ribbonClientPanel1.Style.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid;this.ribbonClientPanel1.Style.BorderTopWidth = 1;this.ribbonClientPanel1.Style.Class = "RibbonClientPanel";this.ribbonClientPanel1.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center;this.ribbonClientPanel1.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.ItemText;this.ribbonClientPanel1.StyleMouseDown.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.ItemPressedBackground2;this.ribbonClientPanel1.StyleMouseDown.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.ItemPressedBackground;this.ribbonClientPanel1.StyleMouseDown.BorderColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.ItemPressedBorder;this.ribbonClientPanel1.StyleMouseDown.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.ItemPressedText;this.ribbonClientPanel1.StyleMouseOver.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.ItemHotBackground2;this.ribbonClientPanel1.StyleMouseOver.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.ItemHotBackground;this.ribbonClientPanel1.StyleMouseOver.BorderColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.ItemHotBorder;this.ribbonClientPanel1.StyleMouseOver.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.ItemHotText;this.ribbonClientPanel1.TabIndex = 0;this.slider1.BackColor = System.Drawing.Color.Transparent;this.slider1.Location = new System.Drawing.Point(123, 523);this.slider1.Maximum = 1000; = "slider1";this.slider1.Size = new System.Drawing.Size(161, 20);this.slider1.Style = DevComponents.DotNetBar.eDotNetBarStyle.Office2003;this.slider1.TabIndex = 3;this.slider1.Text = "音量:";this.slider1.V alue = 1000;this.slider1.V alueChanged += new System.EventHandler(this.slider1_Scroll);this.tabControl1.CanReorderTabs = true;this.tabControl1.Controls.Add(this.tabControlPanel3);this.tabControl1.Controls.Add(this.tabControlPanel1);this.tabControl1.Controls.Add(this.tabControlPanel2);this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;this.tabControl1.ForeColor = System.Drawing.SystemColors.ControlText;this.tabControl1.Location = new System.Drawing.Point(0, 96); = "tabControl1";this.tabControl1.SelectedTabFont = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold);this.tabControl1.SelectedTabIndex = 0;this.tabControl1.Size = new System.Drawing.Size(298, 427);this.tabControl1.TabIndex = 9;this.tabControl1.TabLayoutType = DevComponents.DotNetBar.eTabLayoutType.FixedWithNavigationBox;this.tabControl1.Tabs.Add(this.tabItem3);this.tabControl1.Text = "tabControl1";this.tabControlPanel3.Controls.Add(this.lvMusicList);this.tabControlPanel3.Dock = System.Windows.Forms.DockStyle.Fill;this.tabControlPanel3.Location = new System.Drawing.Point(0, 26); = "tabControlPanel3";this.tabControlPanel3.Padding = new System.Windows.Forms.Padding(1);this.tabControlPanel3.Size = new System.Drawing.Size(298, 401);this.tabControlPanel3.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(244)))), ((int)(((byte)(247)))), ((int)(((byte)(222)))));this.tabControlPanel3.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(244)))), ((int)(((byte)(247)))), ((int)(((byte)(222)))));this.tabControlPanel3.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine;this.tabControlPanel3.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(128)))), ((int)(((byte)(88)))));this.tabControlPanel3.Style.BorderSide = ((DevComponents.DotNetBar.eBorderSide)(((DevComponents.DotNetBar.eBorderSide.Left | DevComponents.DotNetBar.eBorderSide.Right)| DevComponents.DotNetBar.eBorderSide.Bottom)));this.tabControlPanel3.Style.GradientAngle = 90;this.tabControlPanel3.TabIndex = 3;this.tabControlPanel3.TabItem = this.tabItem3;this.lvMusicList.Columns.AddRange(newSystem.Windows.Forms.ColumnHeader[] {this.columnHeader1,this.columnHeader2,this.columnHeader3});this.lvMusicList.ContextMenuStrip = this.contextMenuStrip1;this.lvMusicList.Dock = System.Windows.Forms.DockStyle.Fill;this.lvMusicList.FullRowSelect = true;this.lvMusicList.GridLines = true;this.lvMusicList.Location = new System.Drawing.Point(1, 1); = "lvMusicList";this.lvMusicList.Size = new System.Drawing.Size(296, 399);this.lvMusicList.TabIndex = 0;eCompatibleStateImageBehavior = false;this.lvMusicList.View = System.Windows.Forms.View.Details;this.lvMusicList.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.lvMusicList_MouseDoubleClick);this.columnHeader1.Text = "";this.columnHeader1.Width = 30;this.columnHeader2.Text = "";this.columnHeader2.Width = 172;this.columnHeader3.Text = "";this.columnHeader3.Width = 75;this.tabItem3.AttachedControl = this.tabControlPanel3; = "tabItem3";this.tabItem3.Text = "本地歌曲";this.tabControlPanel1.Dock = System.Windows.Forms.DockStyle.Fill;this.tabControlPanel1.Location = new System.Drawing.Point(0, 26); = "tabControlPanel1";this.tabControlPanel1.Padding = new System.Windows.Forms.Padding(1);this.tabControlPanel1.Size = new System.Drawing.Size(298, 401);this.tabControlPanel1.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(244)))), ((int)(((byte)(247)))), ((int)(((byte)(222)))));this.tabControlPanel1.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(244)))), ((int)(((byte)(247)))), ((int)(((byte)(222)))));this.tabControlPanel1.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine;this.tabControlPanel1.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(128)))), ((int)(((byte)(88)))));this.tabControlPanel1.Style.BorderSide = ((DevComponents.DotNetBar.eBorderSide)(((DevComponents.DotNetBar.eBorderSide.Left | DevComponents.DotNetBar.eBorderSide.Right)| DevComponents.DotNetBar.eBorderSide.Bottom)));this.tabControlPanel1.Style.GradientAngle = 90;this.tabControlPanel1.TabIndex = 1;this.tabControlPanel1.TabItem = this.tabItem1;this.tabItem1.AttachedControl = this.tabControlPanel1; = "tabItem1";this.tabItem1.Text = "本地歌曲";this.tabControlPanel2.Dock = System.Windows.Forms.DockStyle.Fill;this.tabControlPanel2.Location = new System.Drawing.Point(0, 26); = "tabControlPanel2";this.tabControlPanel2.Padding = new System.Windows.Forms.Padding(1);this.tabControlPanel2.Size = new System.Drawing.Size(298, 401);this.tabControlPanel2.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(244)))), ((int)(((byte)(247)))), ((int)(((byte)(222)))));this.tabControlPanel2.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(244)))), ((int)(((byte)(247)))), ((int)(((byte)(222)))));this.tabControlPanel2.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine;this.tabControlPanel2.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(128)))), ((int)(((byte)(88)))));this.tabControlPanel2.Style.BorderSide = ((DevComponents.DotNetBar.eBorderSide)(((DevComponents.DotNetBar.eBorderSide.Left | DevComponents.DotNetBar.eBorderSide.Right)| DevComponents.DotNetBar.eBorderSide.Bottom)));this.tabControlPanel2.Style.GradientAngle = 90;this.tabControlPanel2.TabIndex = 2;this.tabControlPanel2.TabItem = this.tabItem2;this.tabItem2.AttachedControl = this.tabControlPanel2; = "tabItem2";this.tabItem2.Text = "网络歌曲";this.statusStrip1.BackColor = System.Drawing.Color.Transparent;this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {this.toolStripDropDownButton1,this.toolStripDropDownButton2});this.statusStrip1.Location = new System.Drawing.Point(0, 523); = "statusStrip1";this.statusStrip1.Size = new System.Drawing.Size(298, 22);this.statusStrip1.TabIndex = 10;this.statusStrip1.Text = "statusStrip1";this.toolStripDropDownButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;this.toolStripDropDownButton1.DropDownItems.AddRange(newSystem.Windows.Forms.ToolStripItem[] {this.tsmiOpenMusic,this.tsmiOpenFolderMusic,this.toolStripMenuItem1,this.tsmiOpenUrlMusic});this.toolStripDropDownButton1.Image = ((System.Drawing.Image)(resources.GetObject("toolStripDropDownButton1.Image")));this.toolStripDropDownButton1.ImageTransparentColor = System.Drawing.Color.Magenta; = "toolStripDropDownButton1";this.toolStripDropDownButton1.Size = new System.Drawing.Size(42, 20);this.toolStripDropDownButton1.Text = "文件"; = "tsmiOpenMusic";this.tsmiOpenMusic.Size = new System.Drawing.Size(154, 22);this.tsmiOpenMusic.Text = "添加本地歌曲";this.tsmiOpenMusic.Click += new System.EventHandler(this.tsmiOpenMusic_Click); = "tsmiOpenFolderMusic";this.tsmiOpenFolderMusic.Size = new System.Drawing.Size(154, 22);this.tsmiOpenFolderMusic.Text = "添加本地文件夹";this.tsmiOpenFolderMusic.Click += new System.EventHandler(this.tsmiOpenFolderMusic_Click); = "toolStripMenuItem1";this.toolStripMenuItem1.Size = new System.Drawing.Size(151, 6); = "tsmiOpenUrlMusic";this.tsmiOpenUrlMusic.Size = new System.Drawing.Size(154, 22);this.tsmiOpenUrlMusic.Text = "添加网络歌曲";this.toolStripDropDownButton2.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;this.toolStripDropDownButton2.Image = ((System.Drawing.Image)(resources.GetObject("toolStripDropDownButton2.Image")));this.toolStripDropDownButton2.ImageTransparentColor = System.Drawing.Color.Magenta; = "toolStripDropDownButton2";this.toolStripDropDownButton2.Size = new System.Drawing.Size(42, 20);this.toolStripDropDownButton2.Text = "系统";this.panel2.BackColor = System.Drawing.Color.Transparent;this.panel2.Controls.Add(this.btnPre);this.panel2.Controls.Add(this.btnLast);this.panel2.Controls.Add(this.btnPlayOrPause);this.panel2.Controls.Add(this.btnStop);this.panel2.Dock = System.Windows.Forms.DockStyle.Top;this.panel2.Location = new System.Drawing.Point(0, 66); = "panel2";this.panel2.Size = new System.Drawing.Size(298, 30);this.panel2.TabIndex = 8;this.btnPre.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;this.btnPre.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;this.btnPre.Enabled = false;this.btnPre.Location = new System.Drawing.Point(4, 3); = "btnPre";this.btnPre.Size = new System.Drawing.Size(72, 23);this.btnPre.Style = DevComponents.DotNetBar.eDotNetBarStyle.Office2003;this.btnPre.TabIndex = 5;this.btnPre.Text = "上一曲";this.btnPre.Click += new System.EventHandler(this.btnPre_Click);this.btnLast.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;this.btnLast.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;this.btnLast.Enabled = false;this.btnLast.Location = new System.Drawing.Point(220, 3); = "btnLast";this.btnLast.Size = new System.Drawing.Size(72, 23);this.btnLast.Style = DevComponents.DotNetBar.eDotNetBarStyle.Office2003;this.btnLast.TabIndex = 6;this.btnLast.Text = "下一曲";this.btnLast.Click += new System.EventHandler(this.btnLast_Click);this.btnPlayOrPause.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;this.btnPlayOrPause.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;this.btnPlayOrPause.Enabled = false;this.btnPlayOrPause.Location = new System.Drawing.Point(76, 3); = "btnPlayOrPause";this.btnPlayOrPause.Size = new System.Drawing.Size(72, 23);this.btnPlayOrPause.Style = DevComponents.DotNetBar.eDotNetBarStyle.Office2003;this.btnPlayOrPause.TabIndex = 4;this.btnPlayOrPause.Text = "开始播放";this.btnPlayOrPause.Click += new System.EventHandler(this.btnPlayOrPause_Click);this.btnStop.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;this.btnStop.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;this.btnStop.Enabled = false;this.btnStop.Location = new System.Drawing.Point(148, 3); = "btnStop";this.btnStop.Size = new System.Drawing.Size(72, 23);this.btnStop.Style = DevComponents.DotNetBar.eDotNetBarStyle.Office2003;this.btnStop.TabIndex = 7;this.btnStop.Text = "停止播放";this.btnStop.Click += new System.EventHandler(this.btnStop_Click);this.pnlTop.BackColor = System.Drawing.Color.Transparent;this.pnlTop.Controls.Add(this.lblMin);this.pnlTop.Controls.Add(this.lblExit);this.pnlTop.Controls.Add(this.progressBarX1);this.pnlTop.Controls.Add(this.chkAudioOnOff);this.pnlTop.Controls.Add(this.lblCurrentPosition);this.pnlTop.Controls.Add(this.lblDuration);this.pnlTop.Controls.Add(this.lblMusicName);this.pnlTop.Dock = System.Windows.Forms.DockStyle.Top;this.pnlTop.Location = new System.Drawing.Point(0, 0); = "pnlTop";this.pnlTop.Size = new System.Drawing.Size(298, 66);this.pnlTop.TabIndex = 3;this.pnlTop.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pnlTop_MouseMove);this.pnlTop.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pnlTop_MouseDown);this.lblMin.AutoSize = true;this.lblMin.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));this.lblMin.Location = new System.Drawing.Point(260, 2); = "lblMin";this.lblMin.Size = new System.Drawing.Size(17, 16);this.lblMin.TabIndex = 10;this.lblMin.Text = "-";this.lblMin.Click += new System.EventHandler(this.lblMin_Click);this.lblExit.AutoSize = true;this.lblExit.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));this.lblExit.Location = new System.Drawing.Point(279, 3); = "lblExit";this.lblExit.Size = new System.Drawing.Size(15, 14);this.lblExit.TabIndex = 9;this.lblExit.Text = "X";this.lblExit.Click += new System.EventHandler(this.lblExit_Click);this.progressBarX1.BackColor = System.Drawing.Color.Transparent;this.progressBarX1.Dock = System.Windows.Forms.DockStyle.Bottom;this.progressBarX1.Location = new System.Drawing.Point(0, 56); = "progressBarX1";this.progressBarX1.Size = new System.Drawing.Size(298, 10);this.progressBarX1.TabIndex = 8;this.chkAudioOnOff.AutoSize = true;this.chkAudioOnOff.FlatStyle = System.Windows.Forms.FlatStyle.Flat;this.chkAudioOnOff.Location = new System.Drawing.Point(247, 20); = "chkAudioOnOff";this.chkAudioOnOff.Size = new System.Drawing.Size(45, 16);this.chkAudioOnOff.TabIndex = 1;this.chkAudioOnOff.Text = "静音";eVisualStyleBackColor = true;this.chkAudioOnOff.CheckedChanged += new System.EventHandler(this.chkAudioOnOff_CheckedChanged);this.lblCurrentPosition.AutoSize = true;this.lblCurrentPosition.Location = new System.Drawing.Point(239, 39); = "lblCurrentPosition";this.lblCurrentPosition.Size = new System.Drawing.Size(53, 12);this.lblCurrentPosition.TabIndex = 3;this.lblCurrentPosition.Text = "00:00:00";this.lblDuration.AutoSize = true;this.lblDuration.Location = new System.Drawing.Point(4, 39); = "lblDuration";this.lblDuration.Size = new System.Drawing.Size(53, 12);this.lblDuration.TabIndex = 2;this.lblDuration.Text = "00:00:00";this.lblMusicName.AutoSize = true;this.lblMusicName.Location = new System.Drawing.Point(4, 20); = "lblMusicName";this.lblMusicName.Size = new System.Drawing.Size(77, 12);this.lblMusicName.TabIndex = 1;this.lblMusicName.Text = "暂无音乐文件";this.contextMenuStrip1.Items.AddRange(newSystem.Windows.Forms.ToolStripItem[] {this.tsmenuDeleteChangeMusic,this.删除重复歌曲ToolStripMenuItem,this.toolStripMenuItem4,this.tsmenuClearList}); = "contextMenuStrip1";this.contextMenuStrip1.Size = new System.Drawing.Size(143, 76); = "tsmenuDeleteChangeMusic";this.tsmenuDeleteChangeMusic.Size = new System.Drawing.Size(142, 22);this.tsmenuDeleteChangeMusic.Text = "删除选中歌曲";this.tsmenuDeleteChangeMusic.Click += new System.EventHandler(this.tsmiDeleteChangeMusic_Click);this.删除重复歌曲 = "删除重复歌曲ToolStripMenuItem";this.删除重复歌曲ToolStripMenuItem.Size = new System.Drawing.Size(142, 22);this.删除重复歌曲ToolStripMenuItem.Text = "删除重复歌曲"; = "toolStripMenuItem4";this.toolStripMenuItem4.Size = new System.Drawing.Size(139, 6); = "tsmenuClearList";this.tsmenuClearList.Size = new System.Drawing.Size(142, 22);this.tsmenuClearList.Text = "清空歌曲列表";this.tsmenuClearList.Click += new System.EventHandler(this.tsmiClearList_Click);this.timer1.Tick += new System.EventHandler(this.timer1_Tick);this.notifyIcon1.BalloonTipIcon = ;this.notifyIcon1.Text = "草莓¢音乐播放器";this.notifyIcon1.DoubleClick += new System.EventHandler(this.notifyIcon1_DoubleClick);this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;this.ClientSize = new System.Drawing.Size(298, 545);this.Controls.Add(this.ribbonClientPanel1);this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;this.MaximizeBox = false; = "Frm";this.Opacity = 0;this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;this.Text = "草莓¢音乐播放器";this.Load += new System.EventHandler(this.Frm_Load);this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Frm_FormClosing);this.Resize += new System.EventHandler(this.Frm_Resize);this.ribbonClientPanel1.ResumeLayout(false);this.ribbonClientPanel1.PerformLayout();((ponentModel.ISupportInitialize)(this.tabControl1)).EndInit();this.tabControl1.ResumeLayout(false);this.tabControlPanel3.ResumeLayout(false);this.statusStrip1.ResumeLayout(false);this.statusStrip1.PerformLayout();this.panel2.ResumeLayout(false);this.pnlTop.ResumeLayout(false);this.pnlTop.PerformLayout();this.contextMenuStrip1.ResumeLayout(false);this.ResumeLayout(false);}private DevComponents.DotNetBar.Ribbon.RibbonClientPanel ribbonClientPanel1;private DevComponents.DotNetBar.ButtonX btnLast;private DevComponents.DotNetBar.ButtonX btnStop;private DevComponents.DotNetBar.ButtonX btnPlayOrPause;private DevComponents.DotNetBar.ButtonX btnPre;private System.Windows.Forms.Panel panel2;private DevComponents.DotNetBar.TabControl tabControl1;private DevComponents.DotNetBar.TabControlPanel tabControlPanel1;private DevComponents.DotNetBar.TabItem tabItem1;private DevComponents.DotNetBar.TabControlPanel tabControlPanel2;private DevComponents.DotNetBar.TabItem tabItem2;private System.Windows.Forms.StatusStrip statusStrip1;private System.Windows.Forms.ToolStripDropDownButton toolStripDropDownButton1;private System.Windows.Forms.ToolStripMenuItem tsmiOpenMusic;private System.Windows.Forms.ToolStripMenuItem tsmiOpenFolderMusic;private System.Windows.Forms.ToolStripSeparator toolStripMenuItem1;private System.Windows.Forms.ToolStripMenuItem tsmiOpenUrlMusic;private System.Windows.Forms.Timer timer1;private DevComponents.DotNetBar.Controls.Slider slider1;private System.Windows.Forms.ToolStripDropDownButton toolStripDropDownButton2;private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;private System.Windows.Forms.ToolStripMenuItem tsmenuDeleteChangeMusic;private System.Windows.Forms.ToolStripMenuItem 删除重复歌曲ToolStripMenuItem;private System.Windows.Forms.ToolStripSeparator toolStripMenuItem4;private System.Windows.Forms.ToolStripMenuItem tsmenuClearList;private System.Windows.Forms.NotifyIcon notifyIcon1;private System.Windows.Forms.Panel pnlTop;private DevComponents.DotNetBar.Controls.ProgressBarX progressBarX1;private System.Windows.Forms.CheckBox chkAudioOnOff;private bel lblCurrentPosition;private bel lblDuration;private bel lblMusicName;private DevComponents.DotNetBar.TabControlPanel tabControlPanel3;private System.Windows.Forms.ListView lvMusicList;private System.Windows.Forms.ColumnHeader columnHeader1;private System.Windows.Forms.ColumnHeader columnHeader2;private System.Windows.Forms.ColumnHeader columnHeader3;private DevComponents.DotNetBar.TabItem tabItem3;private bel lblExit;private bel lblMin;}}以下是功能模块代码:using System;using System.Collections.Generic;using ponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.Runtime.InteropServices;using System.Xml;using System.Diagnostics;using System.IO;namespace CmTTPlayer{public partial class Frm : Form{////// 强行释放内存资源///////////////[DllImport("kernel32", EntryPoint = "SetProcessWorkingSetSize", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]public static extern int SetProcessWorkingSetSize(int hProcess, int dwMinimumWorkingSetSize, int dwMaximumWorkingSetSize);private Media media = new Media();//自增长序号private int number = 1;//当前播放曲目Indexprivate int changeValue = 0;//当前播放曲目自增长序号private string changeItemText = "1";private Timer tmrShow = new Timer();Timer tmrClose;private int startX, StartY;public Frm(){InitializeComponent();}////// 初始化窗体数据/////////private void Frm_Load(object sender, EventArgs e){//获取进程的模块名称string mName = Process.GetCurrentProcess().MainModule.ModuleName;//返回没有扩展名的模块名称string pName = Path.GetFileNameWithoutExtension(mName);Process[] myProcess = Process.GetProcessesByName(pName);if (myProcess.Length > 1){MessageBox.Show("当前程序已经运行", "系统提示", MessageBoxButtons.OK, rmation);this.Dispose();Application.ExitThread();}else{this.tmrShow.Tick += new EventHandler(this.tmrShow_Tick);this.tmrShow.Enabled = true;}//设置图标this.Icon = Icon.ExtractAssociatedIcon("CmTTPlayer.ico");this.notifyIcon1.Icon = Icon.ExtractAssociatedIcon("CmTTPlayer.ico");media.SetAudioSource(Media.AudioSource.H);XmlDocument xmlDoc = new XmlDocument();//获取当前应用程序路径string path = Process.GetCurrentProcess().MainModule.FileName.Substring(0, Process.GetCurrentProcess()stIndexOf("\\"));//加载Xml文件xmlDoc.Load(path + "\\MusicFile.xml");XmlNode root = xmlDoc.SelectSingleNode("musiclist");//查找XmlNodeList xnl = root.ChildNodes;for (int i = 0; i < xnl.Count; i++){ListViewItem item = new ListViewItem(number.ToString());item.SubItems.AddRange(new string[] { root.ChildNodes[i].Attributes["genre"].Value, root.ChildNodes[i].Attributes["lenght"].Value });item.Tag = root.ChildNodes[i].Attributes["filename"].Value;lvMusicList.Items.Add(item);number++;Application.DoEvents();}//在加载事件中执行以下SetProcessWorkingSetSize(System.Diagnostics.Process.GetCurrentProcess().Handle.ToInt32(), -1, -1);}。
c语言编写的音乐播放器源代码)

include <windows.h> #include <stdio.h>#include <stdlib.h>#include <string.h>#include <conio.h>unsigned frequency[100];char hight[100];unsigned time[100];unsigned rate;void main(){voidset(unsignedf[],charh[],unsignedt[],int r,int num);void music(unsigned f[],unsigned t[],intnum);int flag=0;FILE *f1;int i,n,menu;char FileName[30];while(1){f1=NULL;i=n=0;printf("本程序采用编码的形式播放音乐。
\n");printf("\n用记事本编辑乐谱,然后通过输入文件名播放音乐\n");printf("乐谱文件可以自创,也可以抄别人的\n");printf("\n现在可以先输入数字再按回车播放音乐:\n");printf("1播放指定音乐music1\n");printf("2播放指定音乐music2\n");printf("3通过程序文件名播放音乐\n");printf("4退出\n");while(1){printf("menu=");scanf("%d",&menu);if(menu==1) {strcpy(FileName,"music1.txt");break;}if(menu==2){strcpy(FileName,"music2.txt");break;}if(menu==3){scanf("%s",FileName);break;}if(menu==4)exit(0);}printf("\n该文件的音乐编码如下:\n");if((f1=fopen(FileName,"r"))==NULL){ printf("不能打开文件!\n");exit(1);}fscanf(f1,"%d",&rate);while(!feof(f1)&&flag!=1){fscanf(f1," %d%c%d",&frequency[i],&hight[i],&time[i]);printf("%d%c%d",frequency[i],hight[i],time[i]);if(time[i]!=-1){i++;n++;}elseflag=1;}printf("\n");set(frequency,hight,time,rate,n);music(frequency,time,n);fclose(f1);}getch();}void set(unsigned f[],char h[],unsigned t[],int r,int num){int i,k;for(i=0;i<num;i++){t[i]=t[i]*r;switch(h[i]){case 'H':k=4;break;case 'M':k=2;break;case 'L':k=1;}switch(f[i]){case 1: f[i]=262*k; break;case 2: f[i]=296*k; break;case 3: f[i]=330*k; break;case 4: f[i]=349*k; break;case 5: f[i]=392*k; break; case 6: f[i]=440*k; break;case 7: f[i]=494*k; break;} }}voidmusic(unsignedf[],unsignedt[],intnum){int i;for(i=0;i<num;i++){Beep(f[i],t[i]);}。
C#编写的音乐播放器

主要代码:using System;using System.Collections.Generic;using ponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.IO;using System.Media;using System.Drawing.Drawing2D;using System.Data.OleDb;namespace MusicPlayer{public partial class Form1 : Form{public Form1(){InitializeComponent();}string[] MusicFileNames;bool SingleLoop = true;bool AllLoop = true;bool noramal = true;bool RandomLoop = true;#region//播放private void btnPlay_Click(object sender, EventArgs e){noramal = true;if (this.axWindowsMediaPlayer1.Ctlcontrols.currentPosition == 0){if (this.listView1.Items.Count > 0){timer1.Start();if (this.listView1.SelectedItems.Count > 0){int iPos = this.listView1.SelectedItems[0].Index;string FileName = this.listView1.Items[iPos].SubItems[2].Text;this.axWindowsMediaPlayer1.URL = FileName;}}else{MessageBox.Show("请选择歌曲!", "信息提示", MessageBoxButtons.OK,rmation);}}else{this.axWindowsMediaPlayer1.Ctlcontrols.play();}}#endregion#region//停止private void btnStop_Click(object sender, EventArgs e){timer1.Stop();if (this.listView1.Items.Count > 0){if (this.listView1.SelectedItems.Count > 0){timer1.Enabled = false;axWindowsMediaPlayer1.Ctlcontrols.stop();}}else{MessageBox.Show("请选择歌曲!", "信息提示", MessageBoxButtons.OK, rmation);}}#endregion#region//暂停private void btnPause_Click(object sender, EventArgs e){timer1.Stop();if (this.listView1.Items.Count > 0){if (this.listView1.SelectedItems.Count > 0){timer1.Enabled = false;axWindowsMediaPlayer1.Ctlcontrols.pause();}}else{MessageBox.Show("请选择歌曲!", "信息提示", MessageBoxButtons.OK, rmation);}}#endregion#region//上一首private void btnLast_Click(object sender, EventArgs e){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[2].Text;this.axWindowsMediaPlayer1.URL = FileName;}else{MessageBox.Show("这已经是第一首歌曲了!", "信息提示", MessageBoxButtons.OK, rmation);}}else{MessageBox.Show("请选择歌曲!", "信息提示", MessageBoxButtons.OK, rmation);}}#endregion#region//下一首private void btnNext_Click(object sender, EventArgs e){if (this.listView1.SelectedItems.Count > 0){int iPos = this.listView1.SelectedItems[0].Index;if (iPos < this.listView1.Items.Count - 1){this.listView1.Items[iPos + 1].Selected = true;string FileName = this.listView1.Items[iPos + 1].SubItems[2].Text;this.axWindowsMediaPlayer1.URL = FileName;}else{MessageBox.Show("这已经是最后一首歌曲了!", "信息提示", MessageBoxButtons.OK, rmation);}else{MessageBox.Show("请选择歌曲!", "信息提示", MessageBoxButtons.OK, rmation);}}#endregion#region//双击列表private void listView1_DoubleClick(object sender, EventArgs e){timer1.Start();noramal = true;if (this.listView1.Items.Count > 0){if (this.listView1.SelectedItems.Count > 0){int iPos = this.listView1.SelectedItems[0].Index;string FileName = this.listView1.Items[iPos].SubItems[2].Text;this.axWindowsMediaPlayer1.URL = FileName;}}else{MessageBox.Show("请选择歌曲!", "信息提示", MessageBoxButtons.OK, rmation);}}#endregion#region//播放方式(实现循环)private void timer1_Tick(object sender, EventArgs e) //用timer_tick 来实现循环{int record = this.listView1.SelectedItems[0].Index;int iTotal = this.listView1.Items.Count-1;Random rnd = new Random(); //定义随机函数int rand = rnd.Next(1, iTotal);if (AllLoop == true&&noramal==false){if (this.axWindowsMediaPlayer1.playState == WMPLib.WMPPlayState.wmppsStopped)if (record < this.listView1.Items.Count - 1){this.listView1.Items[record + 1].Selected = true;string FileName = this.listView1.Items[record + 1].SubItems[2].Text;this.axWindowsMediaPlayer1.URL = FileName;}else if (record == this.listView1.Items.Count - 1){this.listView1.Items[0].Selected = true;string FileName = this.listView1.Items[0].SubItems[2].Text;this.axWindowsMediaPlayer1.URL = FileName;}}}else if (SingleLoop == true&&noramal==false){if (this.axWindowsMediaPlayer1.playState == WMPLib.WMPPlayState.wmppsStopped){this.listView1.Items[record].Selected = true;this.axWindowsMediaPlayer1.Ctlcontrols.play();}}else if (noramal == true){if (this.axWindowsMediaPlayer1.playState == WMPLib.WMPPlayState.wmppsStopped){if (record < this.listView1.Items.Count - 1){this.listView1.Items[record + 1].Selected = true;string FileName = this.listView1.Items[record + 1].SubItems[2].Text;this.axWindowsMediaPlayer1.URL = FileName;}else if (record == this.listView1.Items.Count - 1){this.axWindowsMediaPlayer1.Ctlcontrols.stop();}}}else if (RandomLoop == true && noramal == false){if (this.axWindowsMediaPlayer1.playState ==WMPLib.WMPPlayState.wmppsStopped){if ((record+rand) < this.listView1.Items.Count - 1){this.listView1.Items[record + rand].Selected = true;string FileName = this.listView1.Items[record + rand].SubItems[2].Text;this.axWindowsMediaPlayer1.URL = FileName;}else if ((record+rand)>= this.listView1.Items.Count - 1){this.listView1.Items[rand].Selected = true;string FileName = this.listView1.Items[rand].SubItems[2].Text;this.axWindowsMediaPlayer1.URL = FileName;}}}}#endregion#region//添加文件private void 添加文件ToolStripMenuItem_Click(object sender, EventArgs e) //添加文件以及其中的信息{this.openFileDialog1.Multiselect=true;if (this.openFileDialog1.ShowDialog() == DialogResult.OK){MusicFileNames = this.openFileDialog1.FileNames;foreach (string MusicName in MusicFileNames){FileInfo MyFileInfo = new FileInfo(MusicName);//曲名string MyShortFileName = MusicName.Substring(stIndexOf("\\") + 1);MyShortFileName = MyShortFileName.Substring(0, MyShortFileName.Length - 4);//大小float MyFileSize = (float)MyFileInfo.Length / (1024 * 1024);//载入string[] SubItem ={ MyShortFileName, MyFileSize.ToString().Substring(0, 4) + "M", MusicName };ListViewItem Item = new ListViewItem(SubItem);this.listView1.Items.Add(Item);this.listView1.Items[0].Selected = true;WMPLib.IWMPMedia media = this.axWindowsMediaPlayer1.newMedia(MusicName);this.axWindowsMediaPlayer1.currentPlaylist.appendItem(media);}}}#endregion#region//添加文件夹private void 添加文件夹ToolStripMenuItem_Click(object sender, EventArgs e) //添加文件夹以及其中文件的信息{if (this.folderBrowserDialog1.ShowDialog() == DialogResult.OK){DirectoryInfo dir = new DirectoryInfo(this.folderBrowserDialog1.SelectedPath);foreach (FileInfo f in dir.GetFiles("*.*")){//曲名string MyShortFileName = ;MyShortFileName = MyShortFileName.Substring(0, MyShortFileName.Length - 4);//大小float MyFileSize = (float)f.Length / (1024 * 1024);//载入string[] SubItem ={ MyShortFileName, MyFileSize.ToString().Substring(0, 4) + "M",f.FullName };ListViewItem Item = new ListViewItem(SubItem);this.listView1.Items.Add(Item);this.listView1.Items[0].Selected = true;WMPLib.IWMPMedia media = this.axWindowsMediaPlayer1.newMedia(f.DirectoryName);this.axWindowsMediaPlayer1.currentPlaylist.appendItem(media);}}}#endregion#region//播放方式private void 顺序播放ToolStripMenuItem_Click(object sender, EventArgs e){noramal = true;RandomLoop = false;SingleLoop = false;AllLoop = false;this.顺序播放ToolStripMenuItem.Checked = true;this.单曲播放ToolStripMenuItem.Checked = false;this.全部循环ToolStripMenuItem.Checked = false;this.随机播放ToolStripMenuItem.Checked = false;}private void 单曲播放ToolStripMenuItem_Click(object sender, EventArgs e) {SingleLoop = true;AllLoop = false;noramal = false;RandomLoop = false;this.顺序播放ToolStripMenuItem.Checked = false;this.单曲播放ToolStripMenuItem.Checked = true;this.全部循环ToolStripMenuItem.Checked = false;this.随机播放ToolStripMenuItem.Checked = false;}private void 全部循环ToolStripMenuItem_Click(object sender, EventArgs e) {AllLoop = true;SingleLoop = false;noramal = false;RandomLoop = false;this.顺序播放ToolStripMenuItem.Checked = false;this.单曲播放ToolStripMenuItem.Checked = false;this.全部循环ToolStripMenuItem.Checked = true;this.随机播放ToolStripMenuItem.Checked = false;}private void 随机播放ToolStripMenuItem_Click(object sender, EventArgs e) {RandomLoop = true;SingleLoop = false;AllLoop = false;noramal = false;this.顺序播放ToolStripMenuItem.Checked = false;this.单曲播放ToolStripMenuItem.Checked = false;this.全部循环ToolStripMenuItem.Checked = false;this.随机播放ToolStripMenuItem.Checked = true;}#endregion#region//删除文件private void 删除选中的ToolStripMenuItem_Click(object sender, EventArgs e) {timer1.Stop();if (this.listView1.Items.Count > 0){if (this.listView1.SelectedItems.Count > 0){int i = this.listView1.SelectedItems[0].Index;this.listView1.SelectedItems[0].Remove();}else{MessageBox.Show("请选择歌曲!", "信息提示", MessageBoxButtons.OK, rmation);}}else{MessageBox.Show("没有要删除的歌曲!", "信息提示", MessageBoxButtons.OK, rmation);}}private void 全部删除ToolStripMenuItem_Click(object sender, EventArgs e){timer1.Stop();if (this.listView1.Items.Count > 0){this.listView1.Items.Clear();}else{MessageBox.Show("没有要删除的歌曲!", "信息提示", MessageBoxButtons.OK, rmation);}}#endregion}}。
手把手教您用MFC做MP3音乐播放器

打开vc6.0,建立如图所示mfc工程文件选择基于对话框的确定删除所有空间,建立如图所示对话框属性如下:播放IDC_open;添加IDC_fileopen;暂停IDC_pause;删除IDC_del;停止IDC_stop;退出IDC_exit;音乐名编辑框IDC_filename;音量控制滑块IDC_SLIDER1;音量控制编辑框IDC_vol;建立类向导对应如下:在onpaint函数下添加代码void CMp3Dlg::OnPaint(){if (IsIconic()){CPaintDC dc(this); // device context for paintingSendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);// Center icon in client rectangleint cxIcon = GetSystemMetrics(SM_CXICON);int cyIcon = GetSystemMetrics(SM_CYICON);CRect rect;GetClientRect(&rect);int x = (rect.Width() - cxIcon + 1) / 2;int y = (rect.Height() - cyIcon + 1) / 2;// Draw the icondc.DrawIcon(x, y, m_hIcon);}else{//CDialog::OnPaint();CPaintDC dc(this);CRect rect;GetClientRect(&rect);CDC dcMem;dcMem.CreateCompatibleDC(&dc);CBitmap bmpBackground;bmpBackground.LoadBitmap(IDB_BITMAP6); /IDB_BITMAP6是你的位图地址BITMAP bitmap;bmpBackground.GetBitmap(&bitmap);CBitmap *pbmpOld=dcMem.SelectObject(&bmpBackground);dc.StretchBlt(0,0,rect.Width(),rect.Height(),&dcMem,0,0,bitmap.bmWidth,bitmap.bmHeight ,SRCCOPY);}}编译运行,你就会看到背景有图片了。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
5.本系统的源代码如下 // myplayerDlg.cpp : implementation file //
#include "stdafx.h" #include "myplayer.h" #include "myplayerDlg.h"
#ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif
CAboutDlg();
// Dialog Data //{{AFX_DATA(CAboutDlg) enum { IDD = IDD_ABOUTBOX }; //}}AFX_DATA
// ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CAboutDlg) protected: virtual void DoDataExchange(CDataExchange* pDX); //}}AFX_VIRTUAL
打开多媒体文件,给 CMyplayerDlg::Onopen()函数添加相应代码,如下所示: void CMyplayerDlg::Onopen() {
// TODO: Add your control notification handler code here CFileDialog OpenDlg(TRUE);
CMyplayerDlg::OnRadio1() 播放 wav 音频 CMyplayerDlg::OnRadio2() 播放动画音频 CMyplayerDlg::OnRadio3() 播放 mid 音频 CMyplayerDlg::OnRadio4() 播放 CD 音乐 CMyplayerDlg::OnRadio5() 播放 mp3 音乐 首先对界面进行初始化,在程序运行初期,若没打开有效的音频文件,出打开 音乐按钮外,其他按钮均处于禁用状态,代码设计如下 BOOL CMyplayerDlg::OnInitDialog() {
///////////////////////////////////////////////////////////////////////////// // CAboutDlg dialog used for App About
class CAboutDlg : public CDialog { public:
switch(this->m_Mediatype) { case 1:OpenDlg.m_ofn.lpstrFilter="Wave Files(*.wav)\0*.wav\0\0";
this->m_multimedia.SetDeviceType("WaveAudio"); break; case 2:OpenDlg.m_ofn.lpstrFilter="AVI Files(*.avi)\0*.avi\0\0"; this->m_multimedia.SetDeviceType("AviAudio"); break; case 3:OpenDlg.m_ofn.lpstrFilter="Midi Files(*.mid)\0*.mid\0\0"; this->m_multimedia.SetDeviceType("Sequencer"); break; case 4:OpenDlg.m_ofn.lpstrFilter=" "; this->m_multimedia.SetDeviceType("CDAudio"); this->m_multimedia.SetCommand("Open"); this->m_pause.EnableWindow(TRUE); this->m_play.EnableWindow(TRUE); this->m_next.EnableWindow(TRUE); this->m_circle.EnableWindow(TRUE); this->m_close.EnableWindow(TRUE); } if(OpenDlg.DoModal()==IDOK) { this->m_multimedia.SetFileName(OpenDlg.GetFileName()); m_edit.SetWindowText(this->m_multimedia.GetFileName()); this->m_multimedia.SetCommand("Open"); this->m_pause.EnableWindow(TRUE); this->m_play.EnableWindow(TRUE); this->m_next.EnableWindow(TRUE); this->m_circle.EnableWindow(TRUE); this->m_close.EnableWindow(TRUE); } } 这样,程序便可以打开一个选择音频的对话框,选择音乐,如下图所示
对话框”,如图一所示。下面的步骤选取默认值。最后在步骤六单击“完成”按钮, 之后单击“确定”,完成,打开工作空间。
图一:
3.界面设计 在出现的工作界面单击鼠标右键,在弹出的菜单选择其中的 Insert ActiveX
Control 选项,在弹出的对话框选择 Microsoft Multimedia Control 选项,添加一个 MMControl 控件,再依次在对话框窗口上放置六个 Button 控件,两个 Slider 控件, 一个编辑框控件,五个 Radio Button 控件,一个静态控件,添加控件后的窗口体 如图二所示。 图二:
目录
一Hale Waihona Puke 设计目标 二.系统设计 三.系统实现过程
1.程序构成 2.创建项目 3.界面设计 4.程序设计 5.本系统的源代码
四.实验小结
多媒体播放器系统实现
一.设计目标
制作一个具有自己设计风格的简单的媒体播放器。 要求能随机选取要播放的文件,实现前进,回退,暂停,循环播放,音量大小调节 等基本功能。 能播放多种格式的音频视频格式文件,它的功能是能够选择一个有效的以.wav 为后 缀的音乐文件,有效的以.mp3 为后缀的音乐文件,有效的以.mid 为后缀的音乐文件, 有效的以.avi 为后缀的音乐文件,以及 CD 文件,在音乐播放的同时,有一个滑块来显 示播放的进度。 实现其它附加功能如关闭文件,播放下一首曲目等。 界面良好,功能完善
二.系统设计
媒体播放器是一个对话框窗口,主要由四部分构成,概括如下: 1. 打开文件:打开要播放的音频文件并进行选择。 2. 播放、循环播放:对音频文件进行播放或循环播放。 3. 音量调节。 4. 关闭文件。
三.系统实现过程
1.程序构成 媒体播放器主要由以下几个类构成: CMyplayerApp:多媒体播放器主程序。 CMyplayerDlg:用于展现系统运行时的状态。 CAboutDlg 2.创建项目 打开 Visual C++6.0 的集成开发环境,执行“文件”�“新建”菜单项,从弹出的 新建对话框。单击项目选项卡,在工程类型的列表中选择 MFC AppWizard exe 项, 在 Project name 编辑框中输入工程名称 myplyer,在 Location 编辑框中输入保存该 工程文件的路径。单击 OK 按钮弹出 MFC AppWizard-Step 1 对话框,选择“基本
给各个按钮添加相应的函数,各个函数的功能如下: CMyplayerDlg::Onopen():打开音乐文件,并选择要播放的音乐 CMyplayerDlg::Onplay() 播放选中的音乐 CMyplayerDlg::Onpause() 暂停音乐 CMyplayerDlg::Onclose() 关闭音乐 CMyplayerDlg::Onnext() 选择下一首音乐 CMyplayerDlg::Oncircle() 实现循环播放音乐
编写 CMyplayerDlg::Onplay()的代码, 播放选中的音乐, void CMyplayerDlg::Onplay() {
// TODO: Add your control notification handler code here this->m_multimedia.SetCommand("Play"); } 运行程序,便可对选中的音乐进行播放。 编写 CMyplayerDlg::Onpause()的代码, 暂停播放音乐 void CMyplayerDlg::Onpause() { // TODO: Add your control notification handler code here this->m_multimedia.SetCommand("Pause"); } 编写 CMyplayerDlg::Onclose()的代码, 关闭音乐 void CMyplayerDlg::Onclose() { // TODO: Add your control notification handler code here this->m_multimedia.SetCommand("Close"); this->m_pause.EnableWindow(FALSE); this->m_play.EnableWindow(FALSE); this->m_next.EnableWindow(FALSE); this->m_circle.EnableWindow(FALSE); this->m_close.EnableWindow(FALSE); } 编写 CMyplayerDlg::Onnext()的代码,实现选择下一首音乐 void CMyplayerDlg::Onnext() { // TODO: Add your control notification handler code here this->m_multimedia.SetCommand("Next"); Onopen(); this->m_multimedia.SetCommand("Play"); } 编写 CMyplayerDlg::Oncircle() 的代码,实现循环播放音乐 void CMyplayerDlg::Oncircle() { // TODO: Add your control notification handler code here int i; for(i=0;i<50;i++) { this->m_multimedia.SetCommand("Prev"); this->m_multimedia.SetCommand("Play");} } 最后,程序运行结果的界面如下: