资源描述:
《音乐播放器(VB编程源代码)》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、音乐播放器设计一、先来欣赏一下本音乐播放器的最终效果吧:设计思路很简单,即下面两个窗体的设计。二、主窗体(form1)界面设计如下:主窗体(form1)代码如下:DimtAsInteger,aAsBooleanDimpAsInteger,b,wAsBoolean,onePrivateSuballclear_Click()'清空播放列表List1.ClearWMP1.currentPlaylist.ClearForm1.Caption="无任何曲目"EndSubPrivateSuballloop_Click()'
2、全部循环播放Timer3.Enabled=Falseallloop.Checked=Trueoneloop.Checked=Falserand.Checked=Falserule.Checked=FalseCallWMP1.settings.setMode("loop",True)EndSubPrivateSubForm_Load()'初始化Form1.Height=7800w=Falseallloop.Checked=Falseoneloop.Checked=Falserand.Checked=Falseru
3、le.Checked=TrueLabel2.Caption="00:00"'第一次打开时创建文件IfDir("filepath.text")=""AndDir("C:music.txt")=""ThenOpen"C:filepath.txt"ForOutputAs#1Close#1Open"C:music.txt"ForOutputAs#2Close#2EndIf'读取文件Open"C:filepath.txt"ForInputAs#1Open"C:music.txt"ForInputAs#2DoWh
4、ileNotEOF(1)Input#1,XInput#2,YIfDir(X)<>""ThenList1.AddItem(List1.ListCount+1)&"."&YCallWMP1.currentPlaylist.insertItem(WMP1.currentPlaylist.Count,WMP1.newMedia(X))EndIfLoopClose#1Close#2'初始化IfList1.ListCount<>0ThenList1.Selected(0)=TruePicture3(0).Width=114
5、Picture3(0).Height=52Picture3(0).PaintPicturePicture2(0).Picture,0,0,114,52,0,0,114,52Picture3(1).PaintPicturePicture2(2).Picture,0,0,60,52,0,0,60,52Picture3(2).PaintPicturePicture2(3).Picture,0,0,83,52,0,0,83,52Picture3(4).PaintPicturePicture2(5).Picture,0,
6、0,60,52,0,0,60,52Picture3(3).PaintPicturePicture2(4).Picture,0,0,83,52,0,0,83,52Picture11.PaintPicturePicture12.Picture,0,0,19,23,0,0,19,23a=FalseCallWMP1.settings.setMode("shuffle",False)'初始设置为顺序播放Label1.Caption=Mid(List1.List(0),InStr(List1.List(0),".")+1)
7、sd1.Value=50'音量设置为50%EndSubPrivateSubList1_DblClick()'双击播放CallWMP1.Controls.playItem(WMP1.currentPlaylist.Item(List1.ListIndex))a=Truet=1Picture3(0).PaintPicturePicture2(1).Picture,0,0,114,52,0,0,114,52EndSubPrivateSubList1_MouseDown(ButtonAsInteger,ShiftAsI
8、nteger,XAsSingle,YAsSingle)IfX>List1.Width-430Thenw=TrueEndIfEndSubPrivateSubList1_MouseMove(ButtonAsInteger,ShiftAsInteger,XAsSingle,YAsSingle)'伸缩播放列表IfX>List1.Width-430AndX