1、Private Sub Form_Load()初始化Form1.Height = 7800w = Falseallloop.Checked = Falserule.Checked = TrueLabel2.Caption = 00:00第一次打开时创建文件If Dir(filepath.text) = And Dir(C:music.txt ThenOpen filepath.txt For Output As #1Close #1 For Output As #2Close #2End If读取文件 For Input As #1 For Input As #2Do While Not EO
2、F(1) Input #1, X Input #2, Y If Dir(X) List1.AddItem (List1.ListCount + 1) &. & Y Call WMP1.currentPlaylist.insertItem(WMP1.currentPlaylist.Count, WMP1.newMedia(X) End IfLoopIf List1.ListCount List1.Width - 430 Thenw = TruePrivate Sub List1_MouseMove(Button As Integer, Shift As Integer, X As Single,
3、 Y As Single)伸缩播放列表 List1.Width - 430 And X 1500 And X 5800 ThenList1.Width = XPrivate Sub List1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)Private Sub List1_Scroll()Private Sub oneloop_Click()单曲循环oneloop.Checked = TrueTimer3.Enabled = TruePrivate Sub Pc13_MouseDown(Button
4、 As Integer, Shift As Integer, X As Single, Y As Single)播放进度控制If WMP1.playState = wmppsPlaying ThenWMP1.Controls.currentPosition = WMP1.currentMedia.duration * X / 233Pc13.ClsPc13.PaintPicture Pc14.Picture, 0, 0, 233, 17, 234 - X, 0, 233, 17Private Sub Picture1_MouseMove(Button As Integer, Shift As
5、Integer, X As Single, Y As Single)切换图片If t = 0 Then Picture3(0).PaintPicture Picture2(0).Picture, 0, 0, 114, 52, 0, 0, 114, 52If t = 1 Then Picture3(0).PaintPicture Picture2(1).Picture, 0, 0, 114, 52, 0, 0, 114, 52Private Sub Picture10_Click()打开搜索窗体Form2.ShowPrivate Sub Picture11_Click()设置静音sd1.Valu
6、e = 0Picture11.PaintPicture Picture12.Picture, 0, 0, 19, 23, 38, 0, 19, 23Private Sub Picture3_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)If Index = 0 ThenIf a = True Then Call WMP1.Controls.pause 播放 Else Call WMP1.Controls.play 暂停If Index = 3 Thenp = 1
7、Call WMP1.Controls.Next 下一首p = 0If Index = 2 ThenCall WMP1.Controls.previous 上一首If Index = 4 Then Call WMP1.Controls.stop 停止播放打开音乐文件If Index = 1 ThenCommonDialog1.DialogTitle = 打开音乐文件CommonDialog1.Filter = mp3|*.mp3|wma|*.wmaCommonDialog1.InitDir = D:CommonDialog1.ShowOpenfname = CommonDialog1.FileT
8、itlegname = CommonDialog1.FileNameIf fname n = Len(fname) For i = 0 To List1.ListCount - 1 If Right(List1.List(i), n - 4) = Left(fname, n - 4) Then Call WMP1.Controls.playItem(WMP1.currentPlaylist.Item(i) 播放添加后的歌曲 Timer1.Enabled = True List1.ListIndex = i Exit Sub Next Left(fname, n - 4) 歌曲无重复则添加到播放
9、列表,否则不再添加 Call WMP1.currentPlaylist.insertItem(WMP1.currentPlaylist.Count, WMP1.newMedia(gname) List1.ListIndex = List1.ListCount - 1 List1.Selected(i) = True Call WMP1.Controls.playItem(WMP1.currentPlaylist.Item(List1.ListIndex)Private Sub Picture3_MouseMove(Index As Integer, Button As Integer, Shi
10、ft As Integer, X As Single, Y As Single)根据不同情况切换图片,实现动态按钮功能 If X 80 Or Y 48 Then Picture3(0).PaintPicture Picture2(0).Picture, 0, 0, 114, 52, 228, 0, 114, 52 Picture3(0).PaintPicture Picture2(1).Picture, 0, 0, 114, 52, 228, 0, 114, 52 55 Or Y Picture3(1).PaintPicture Picture2(2).Picture, 0, 0, 60, 5
11、2, 0, 0, 60, 52 Picture3(1).PaintPicture Picture2(2).Picture, 0, 0, 60, 52, 60, 0, 60, 52 65 Or Y Picture3(2).PaintPicture Picture2(3).Picture, 0, 0, 83, 52, 0, 0, 83, 52 Picture3(2).PaintPicture Picture2(3).Picture, 0, 0, 83, 52, 83, 0, 83, 52 Picture3(3).PaintPicture Picture2(4).Picture, 0, 0, 83,
12、 52, 0, 0, 83, 52 Picture3(3).PaintPicture Picture2(4).Picture, 0, 0, 83, 52, 166, 0, 83, 52If Index = 4 Then Picture3(4).PaintPicture Picture2(5).Picture, 0, 0, 60, 52, 0, 0, 60, 52 Picture3(4).PaintPicture Picture2(5).Picture, 0, 0, 60, 52, 120, 0, 60, 52Private Sub Picture4_MouseMove(Button As In
13、teger, Shift As Integer, X As Single, Y As Single)图片切换Private Sub Picture5_Click()显示或隐藏播放列表If b = 0 ThenForm1.Width = 5940Form1.Height = 3900b = 1Picture5.ToolTipText = 显示播放列表b = 0隐藏播放列表Private Sub Picture6_Click()最小化窗体Form1.WindowState = 1Private Sub Picture7_Click()关闭窗体之前保存播放列表数据 n = InStr(List1.L
14、ist(i), ) Write #1, WMP1.currentPlaylist.Item(i).sourceURL Write #2, Mid(List1.List(i), n + 1)EndPrivate Sub Picture8_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)播放模式设置菜单PopupMenu menusetPrivate Sub Picture9_Click()删除菜单PopupMenu gclearPrivate Sub rand_Click()随机播放rand.Checke
15、d = TruePrivate Sub rule_Click()顺序播放, False)Private Sub sd1_Change()音量控制条WMP1.settings.volume = sd1.Valuesd1.ToolTipText = 音量 sd1.Value &%If sd1.Value = 0 Then sd1.ToolTipText = 静音If sd1.Value = 100 Then sd1.ToolTipText = 最大音量If sd1.Value 0 ThenPrivate Sub select_Click()删除选中项For i = 0 To List1.ListC
16、ount - 1 If List1.Selected(i) Then List1.RemoveItem (i) m = i Call WMP1.currentPlaylist.RemoveItem(WMP1.currentPlaylist.Item(i) Exit ForNext List1.List(i) = (i + 1) & Mid(List1.List(i), n + 1)If List1.ListCount = 0 Then Exit SubIf List1.ListCount = m ThenList1.Selected(m - 1) = TrueList1.Selected(m) = TruePrivate Sub Timer1_Timer()更新播放动态If WMP1.currentPlaylist.Count If WMP1.playState = 3 ThenLabel2.Caption = WMP1.Controls.currentPositionString a = True t = 1 Picture3(0).ToolTipText = 播放 a = False
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1