📄 mp3play.frm
字号:
'模拟MouseOut事件
If (X < 0) Or (Y < 0) Or (X > .Width) Or (Y > .Height) Then
ReleaseCapture
Onmig = False
Set .Picture = LoadPicture(App.Path & "\mp3\next1.gif")
Else
SetCapture .hWnd
If Onmig = False Then
Set .Picture = LoadPicture(App.Path & "\mp3\next2.gif")
Onmig = True
End If
End If
End With
End Sub
Private Sub Nextmig_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button <> 1 Then
Exit Sub
End If
If MusicIndex < Form16.ListView1.ListItems.Count Then
MusicIndex = MusicIndex + 1
wmp.URL = Form16.ListView1.ListItems.Item(MusicIndex).SubItems(1)
sta = True
Qianmig.Enabled = True
Dangmig.Left = Dangleft
Jingmig.Width = 15
If MusicIndex >= Form16.ListView1.ListItems.Count Then
Nextmig.Enabled = False
End If
End If
End Sub
Private Sub Openmig_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Static Onmig As Boolean
With Openmig
'模拟MouseOut事件
If (X < 0) Or (Y < 0) Or (X > .Width) Or (Y > .Height) Then
ReleaseCapture
Onmig = False
Set .Picture = LoadPicture(App.Path & "\mp3\open1.gif")
Else
SetCapture .hWnd
If Onmig = False Then
Set .Picture = LoadPicture(App.Path & "\mp3\open2.gif")
Onmig = True
End If
End If
End With
End Sub
Private Sub Openmig_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
On Error GoTo er
If Button <> 1 Then
Exit Sub
End If
cd1.ShowOpen
If cd1.FileName <> "" Then
Playmig.Enabled = True
wmp.URL = cd1.FileName
sta = True
Stopmig.Enabled = True
Form16.ListView1.ListItems.Clear
Playmig.Picture = LoadPicture(App.Path & "\mp3\pause1.gif")
Statemig1.Picture = LoadPicture(App.Path & "\mp3\state1-1.gif")
Statemig2.Picture = LoadPicture(App.Path & "\mp3\state2-2.gif")
Statemig3.Picture = LoadPicture(App.Path & "\mp3\state3-2.gif")
Form16.ListView1.ListItems.Add , , cd1.FileTitle
'Form16.ListView1.ListItems.Item(1).SubItems(1) = wmp.currentMedia.durationString
Form16.ListView1.ListItems.Item(1).SubItems(1) = cd1.FileName
MusicIndex = 1
Timer1.Interval = 500
End If
Exit Sub
er:
End Sub
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
ReleaseCapture
SendMessage Me.hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&
End If
End Sub
Private Sub Playmig_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Static Onmig As Boolean
With Playmig
'模拟MouseOut事件
If (X < 0) Or (Y < 0) Or (X > .Width) Or (Y > .Height) Then
ReleaseCapture
Onmig = False
Select Case wmp.playState
Case 3
Set .Picture = LoadPicture(App.Path & "\mp3\pause1.gif")
Case Else
Set .Picture = LoadPicture(App.Path & "\mp3\play1.gif")
End Select
Else
SetCapture .hWnd
If Onmig = False Then
Select Case wmp.playState
Case 3
Set .Picture = LoadPicture(App.Path & "\mp3\pause2.gif")
Case Else
Set .Picture = LoadPicture(App.Path & "\mp3\play2.gif")
End Select
Onmig = True
End If
End If
End With
End Sub
Private Sub Playmig_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button <> 1 Then
Exit Sub
End If
Select Case wmp.playState
Case 0
wmp.URL = Form16.ListView1.ListItems.Item(1).SubItems(1)
Stopmig.Enabled = True
Playmig.Enabled = True
Statemig1.Picture = LoadPicture(App.Path & "\mp3\state1-1.gif")
Statemig2.Picture = LoadPicture(App.Path & "\mp3\state2-2.gif")
Statemig3.Picture = LoadPicture(App.Path & "\mp3\state3-2.gif")
Playmig.Picture = LoadPicture(App.Path & "\mp3\pause1.gif")
Timer1.Interval = 500
sta = True
MusicIndex = 1
Case 1
Statemig1.Picture = LoadPicture(App.Path & "\mp3\state1-1.gif")
Statemig2.Picture = LoadPicture(App.Path & "\mp3\state2-2.gif")
Statemig3.Picture = LoadPicture(App.Path & "\mp3\state3-2.gif")
Playmig.Picture = LoadPicture(App.Path & "\mp3\pause1.gif")
If Form16.ListView1.ListItems.Count <> 0 Then
wmp.URL = Form16.ListView1.ListItems.Item(1).SubItems(1)
sta = True
Else
wmp.Controls.play
End If
MusicIndex = 1
Stopmig.Enabled = True
Timer1.Interval = 500
Case 2
Statemig1.Picture = LoadPicture(App.Path & "\mp3\state1-1.gif")
Statemig2.Picture = LoadPicture(App.Path & "\mp3\state2-2.gif")
Statemig3.Picture = LoadPicture(App.Path & "\mp3\state3-2.gif")
Playmig.Picture = LoadPicture(App.Path & "\mp3\pause1.gif")
wmp.Controls.play
Case 3
Statemig1.Picture = LoadPicture(App.Path & "\mp3\state1-2.gif")
Statemig2.Picture = LoadPicture(App.Path & "\mp3\state2-1.gif")
Statemig3.Picture = LoadPicture(App.Path & "\mp3\state3-2.gif")
wmp.Controls.pause
Playmig.Picture = LoadPicture(App.Path & "\mp3\play1.gif")
End Select
End Sub
Private Sub Qianmig_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Static Onmig As Boolean
With Qianmig
'模拟MouseOut事件
If (X < 0) Or (Y < 0) Or (X > .Width) Or (Y > .Height) Then
ReleaseCapture
Onmig = False
Set .Picture = LoadPicture(App.Path & "\mp3\qian1.gif")
Else
SetCapture .hWnd
If Onmig = False Then
Set .Picture = LoadPicture(App.Path & "\mp3\qian2.gif")
Onmig = True
End If
End If
End With
End Sub
Private Sub Qianmig_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
On Error GoTo er
If Button <> 1 Then
Exit Sub
End If
MusicIndex = MusicIndex - 1
wmp.URL = Form16.ListView1.ListItems.Item(MusicIndex).SubItems(1)
sta = True
Dangmig.Left = Dangleft
Jingmig.Width = 15
Nextmig.Enabled = True
If MusicIndex = 1 Then
Qianmig.Enabled = False
End If
Exit Sub
er:
End Sub
Private Sub Showlistmig_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Static Onmig As Boolean
With Showlistmig
'模拟MouseOut事件
If (X < 0) Or (Y < 0) Or (X > .Width) Or (Y > .Height) Then
ReleaseCapture
Onmig = False
If Form16.Visible = False Then
Set .Picture = LoadPicture(App.Path & "\mp3\top1.gif")
Else
Set .Picture = LoadPicture(App.Path & "\mp3\bottom1.gif")
End If
Else
SetCapture .hWnd
If Onmig = False Then
If Form16.Visible = False Then
Set .Picture = LoadPicture(App.Path & "\mp3\top2.gif")
Else
Set .Picture = LoadPicture(App.Path & "\mp3\bottom2.gif")
End If
Onmig = True
End If
End If
End With
End Sub
Private Sub Showlistmig_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button <> 1 Then
Exit Sub
End If
Static f As Boolean
If f = False Then
f = True
Form16.Show
Form16.Left = Me.Left + Meleft
Form16.Top = Me.Top + Metop
Else
f = False
Form16.Hide
Showlistmig.Picture = LoadPicture(App.Path & "\mp3\top1.gif")
End If
End Sub
Private Sub Stopmig_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Static Onmig As Boolean
With Stopmig
'模拟MouseOut事件
If (X < 0) Or (Y < 0) Or (X > .Width) Or (Y > .Height) Then
ReleaseCapture
Onmig = False
Set .Picture = LoadPicture(App.Path & "\mp3\stop1.gif")
Else
SetCapture .hWnd
If Onmig = False Then
Set .Picture = LoadPicture(App.Path & "\mp3\stop2.gif")
Onmig = True
End If
End If
End With
End Sub
Private Sub Stopmig_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button <> 1 Then
Exit Sub
End If
Timer1.Interval = 0
wmp.Controls.Stop
Stopmig.Enabled = False
Nextmig.Enabled = False
Qianmig.Enabled = False
Statemig1.Picture = LoadPicture(App.Path & "\mp3\state1-2.gif")
Statemig2.Picture = LoadPicture(App.Path & "\mp3\state2-2.gif")
Statemig3.Picture = LoadPicture(App.Path & "\mp3\state3-1.gif")
Playmig.Picture = LoadPicture(App.Path & "\mp3\play1.gif")
Dangmig.Left = Dangleft
Jingmig.Width = 15
MusicIndex = Form16.ListView1.ListItems.Count
End Sub
Private Sub Timer1_Timer()
If wmp.playState = 3 Then
If sta = True Then
sta = False
Musicname.Caption = wmp.currentMedia.Name
If Len(Musicname.Caption) > 6 Then
Musicname.Caption = Left(Musicname.Caption, 5) + ".."
End If
Timer.Caption = wmp.currentMedia.durationString
Jinb = (Jinmig.Width - Dangmig.Width - Dangleft) / wmp.currentMedia.duration
End If
Dangmig.Move wmp.Controls.currentPosition * Jinb + Dangleft
Jingmig.Move Jingmig.Left, Jingmig.Top, wmp.Controls.currentPosition * Jinb + Dangmig.Width
Lasttimer.Caption = wmp.Controls.currentPositionString
ElseIf wmp.playState = 1 Then
If Form16.ListView1.ListItems.Count > MusicIndex Then
MusicIndex = MusicIndex + 1
wmp.URL = Form16.ListView1.ListItems.Item(MusicIndex).SubItems(1)
Else
Timer1.Interval = 0
Statemig1.Picture = LoadPicture(App.Path & "\mp3\state1-2.gif")
Statemig2.Picture = LoadPicture(App.Path & "\mp3\state2-2.gif")
Statemig3.Picture = LoadPicture(App.Path & "\mp3\state3-1.gif")
Lasttimer.Caption = "00:00"
Playmig.Picture = LoadPicture(App.Path & "\mp3\play1.gif")
Stopmig.Enabled = False
Qianmig.Enabled = False
Nextmig.Enabled = False
sta = True
End If
Dangmig.Left = Dangleft
Jingmig.Width = 15
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -