2个回答
展开全部
'完整解决,添加一个按钮,一个计时器和你说的那两个控件,复制以下代码即可
Private Sub Command1_Click()
WindowsMediaPlayer1.URL = "媒体文件的全路径"
Timer1.Interval = 10
End Sub
Private Sub Slider1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = 1 Then WindowsMediaPlayer1.Controls.pause
End Sub
Private Sub Slider1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = 1 Then WindowsMediaPlayer1.Controls.play
End Sub
Private Sub Slider1_Scroll()
WindowsMediaPlayer1.Controls.currentPosition = CDbl(Slider1.Value)
End Sub
Private Sub Timer1_Timer()
Slider1.Value = CInt(WindowsMediaPlayer1.Controls.currentPosition)
End Sub
Private Sub WindowsMediaPlayer1_MediaChange(ByVal Item As Object)
WindowsMediaPlayer1.Controls.play
End Sub
Private Sub WindowsMediaPlayer1_PlayStateChange(ByVal NewState As Long)
Select Case NewState
Case Is = wmppsMediaEnded
Slider1.Value = 0
WindowsMediaPlayer1.Controls.play
Case Is = wmppsPlaying
Slider1.Max = CInt(WindowsMediaPlayer1.currentMedia.duration + 1)
End Select
End Sub
Private Sub Command1_Click()
WindowsMediaPlayer1.URL = "媒体文件的全路径"
Timer1.Interval = 10
End Sub
Private Sub Slider1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = 1 Then WindowsMediaPlayer1.Controls.pause
End Sub
Private Sub Slider1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = 1 Then WindowsMediaPlayer1.Controls.play
End Sub
Private Sub Slider1_Scroll()
WindowsMediaPlayer1.Controls.currentPosition = CDbl(Slider1.Value)
End Sub
Private Sub Timer1_Timer()
Slider1.Value = CInt(WindowsMediaPlayer1.Controls.currentPosition)
End Sub
Private Sub WindowsMediaPlayer1_MediaChange(ByVal Item As Object)
WindowsMediaPlayer1.Controls.play
End Sub
Private Sub WindowsMediaPlayer1_PlayStateChange(ByVal NewState As Long)
Select Case NewState
Case Is = wmppsMediaEnded
Slider1.Value = 0
WindowsMediaPlayer1.Controls.play
Case Is = wmppsPlaying
Slider1.Max = CInt(WindowsMediaPlayer1.currentMedia.duration + 1)
End Select
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询