使用vb.net 制作简易的mp3播放器,只需要添加文件,播放,停止,暂停,快近,上一首,下一首! 20
1个回答
展开全部
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
With OpenFileDialog1
.Filter = "mp3 files(*.mp3)|*.mp3"
End With
If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
AxWindowsMediaPlayer1.openPlayer(OpenFileDialog1.FileName)
Button2.Enabled = True
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Button2.Enabled = False
Button3.Enabled = False
Button4.Enabled = False
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
AxWindowsMediaPlayer1.Ctlcontrols.play()
Button3.Enabled = True
Button4.Enabled = True
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
AxWindowsMediaPlayer1.Ctlcontrols.pause()
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
AxWindowsMediaPlayer1.Ctlcontrols.stop()
Button3.Enabled = False
End Sub
End Class
在com组件中选择Windows Media Player
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
With OpenFileDialog1
.Filter = "mp3 files(*.mp3)|*.mp3"
End With
If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
AxWindowsMediaPlayer1.openPlayer(OpenFileDialog1.FileName)
Button2.Enabled = True
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Button2.Enabled = False
Button3.Enabled = False
Button4.Enabled = False
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
AxWindowsMediaPlayer1.Ctlcontrols.play()
Button3.Enabled = True
Button4.Enabled = True
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
AxWindowsMediaPlayer1.Ctlcontrols.pause()
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
AxWindowsMediaPlayer1.Ctlcontrols.stop()
Button3.Enabled = False
End Sub
End Class
在com组件中选择Windows Media Player
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询