如果您无法下载资料,请参考说明:
1、部分资料下载需要金币,请确保您的账户上有足够的金币
2、已购买过的文档,再次下载不重复扣费
3、资料包下载后请先用软件解压,在使用对应软件打开
usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;usingSystem.IO;namespaceEx182{publicpartialclassForm1:Form{privateboolbool_no_sound=false;//是否静音privateintnum_sound_value=0;//音量privatestringstr_load_dir="";//文件目录publicForm1(){File.AppendAllText("LoadMusic.txt","");//打开文件,追加字符串InitializeComponent();str_load_dir=File.ReadAllText("LoadMusic.txt");if(str_load_dir!="")Loadmusics();}privatevoidLoadmusics(){try{//遍历打开的文件,将文件名添加到ListBox控件中,加入播放文件列表foreach(stringfilenameinDirectory.GetFiles(str_load_dir)){FileInfofi=newFileInfo(filename);if(fi.Extension==".*"||fi.Extension==".wmv"||fi.Extension==".mp3"||fi.Extension==".wma"||fi.Extension==".avi"){listBox1.Items.Add(fi.Name);axWindowsMediaPlayer1.currentPlaylist.insertItem(axWindowsMediaPlayer1.currentPlaylist.count,axWindowsMediaPlayer1.newMedia(filename));}}}catch{File.WriteAllText("LoadMusic.txt","");}}privatevoid打开ToolStripMenuItem_Click(objectsender,EventArgse){OpenFileDialogopen=newOpenFileDialog();//对话框对象//过滤条件open.Filter="所有文件.*|*.*|Wmv视频.wmv|*.wmv|歌曲.mp3|*.mp3|歌曲.wma|*.wma|文件.avi|*.avi";open.FilterIndex=1;if(open.ShowDialog()==DialogResult.OK){FileInfofi=newFileInfo(open.FileName);//获取文件inti;//将打开的文件添加到ListBox控件中for(i=0;i<listBox1.Items.Count;i++){if(fi.Name==listBox1.Items[i].ToString())//有重复不添加break;}if(i==listBox1.Items.Count){this.listBox1.Items.Add(fi.Name);//添加到ListBox控件中//播放文件axWindowsMediaPlayer1.currentPlaylist.insertItem(axWindowsMediaPlayer1.currentPlaylist.count,axWindowsMediaPlayer1.newMedia(open.FileName));}}}boolisplayer=true;privatevoidlabel3_Click(objectsender,EventArgse){if(isplayer){axWindowsMediaPlayer1.Ctlcontrols.pause();//暂停this.label3.Text="播放";isplayer=false;}else{axWindowsMediaPlayer1.Ctlcontrols.play();//播放this.label3.Text="暂停";isplayer=true;}}privatevoidlabel4_Click(objectsender,EventAr