用C++编写音乐播放器
- 格式:pdf
- 大小:245.60 KB
- 文档页数:14
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);}}}。
一个简单的音乐视频系统建立一个项目:代码:点击窗体进入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代码#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 条我的博客上有三首连放的,你只要加两首就行了。
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#做的音乐播放器,但是功能不尽人意。
本人通过网上的播放器源码结合自身的知识做出一个比较好的播放器,供大家交流。
如图:以下是播放器界面代码,新建一个项目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);}。
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]);}。
主要代码: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}}。
打开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);}}编译运行,你就会看到背景有图片了。
C语言实现音乐播放器音乐是人们生活中不可或缺的一部分,而音乐播放器则是让人们能够随时随地欣赏自己喜爱的音乐的工具。
本文将介绍如何使用C语言来实现一个简单的音乐播放器。
一、背景介绍在开始介绍之前,我们先了解一下C语言。
C语言是一种通用的高级计算机程序设计语言,它广泛应用于软件开发、嵌入式系统、操作系统等领域。
C语言具有简洁、高效、灵活等特点,非常适合用来实现音乐播放器这样的应用程序。
二、功能设计一个音乐播放器需要具备以下几个基本功能:1. 播放音乐:能够将音乐文件加载到内存中,并通过音频设备进行播放。
2. 暂停和继续播放:能够控制音乐的播放状态,实现暂停和继续播放功能。
3. 调节音量:能够通过控制音频设备的音量来调节音乐的播放音量。
4. 播放进度条:能够显示当前音乐的播放进度,并能够通过拖动进度条来控制播放进度。
5. 播放列表:能够显示已加载的音乐文件,并能够选择要播放的音乐。
6. 循环播放:能够实现单曲循环、列表循环和随机播放等不同播放模式。
三、技术实现1. 文件加载:使用C语言的文件操作函数,如fopen、fread等,将音乐文件加载到内存中,也可以使用第三方库来简化操作。
2. 音频播放:使用C语言的音频库,如ALSA、SDL等,通过调用相应的函数实现音频播放。
3. 用户界面:使用C语言的图形库,如GTK、SDL等,创建用户界面并实现各种交互操作。
4. 音频处理:使用C语言的音频处理库,如libao、libmad等,对音乐文件进行解码和处理。
5. 播放控制:使用C语言的多线程或事件驱动机制,实现播放控制功能,包括播放、暂停、继续、音量调节等。
6. 播放列表:使用C语言的链表或数组等数据结构,保存已加载的音乐文件,并能够根据用户选择进行切换和播放。
7. 进度条:使用C语言的图形库,绘制并更新进度条的显示,并通过鼠标或键盘事件实现拖动进度条来控制播放进度。
8. 播放模式:使用C语言的条件语句和控制流程,实现不同的播放模式,并能够根据用户选择切换不同的播放模式。
VC++编写视频音乐播放器Softeem Consultancy ServiceVC++编写视频音乐播放器Softeem Consultancy Service音乐播放器程序主要功能音乐播放器可以播放Windows下常用的音频和视频文件,如MP3、MIDI、WAV、WMA等。
程序的界面如图所示。
用户可通过文件对话框添加想要播放的文件和删除音乐文件,并可实现暂停、关闭或重播的功能,保存播放列表,并显示播放的时间和正在播放文件的全路径和文件名,同时,在媒体文件播放的过程中,用户可随时调节音量,还可以设置播放模式,如单曲循环,顺序播放等,同时,可以同步歌词,同步视频,并在桌面显示等。
Softeem Consultancy Service程序界面Softeem Consultancy Service运行效果Softeem Consultancy Service创建初始界面程序实现界面美化1,首先新建一个工程,取个好听的名字,这里命名为Multimedia,然后选择Dialog based,点击OK完成。
2,设置对话框显示风格。
在对话框点右键属性,设置边框为细小,把标题栏复选框去掉,其他默认。
如图:Softeem Consultancy Service3,界面布局。
在对话框中添加相应的控件,完成相应功能,最终效果如图:Softeem Consultancy Service4.进行对话框、控件的相应美化。
(1)给对话框添加背景 (2)给按钮添加位图(3)使静态文本透明 (4) 相关控件的具体美化实现播放音乐Windows MCI与多媒体软件开发 Windows MCI(Media Control Interface)是控制多媒体设备的高层命令接口,提供了与设备无关的控制多媒体设备的方法。
MCI可控制的多媒体设备包括标准的多媒体设备,如CD音频(CD Audio)、数字视频、动画、Wave格式数字声音和MIDI音序器,以及影碟机等可选设备。