我有一个媒体播放器,我作为学校项目的一部分。我有一个按钮,按下后隐藏表格并显示另一个。我想要做的是让按钮也停止播放媒体文件。这是我的代码
Private Sub TxtName_Enter(ByVal sender As System.Object, ByVal e As FormClosingEventArgs) Handles MyBase.FormClosing
e.Cancel = True
End Sub
Private Sub BtnBrowse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnBrowse.Click
With OpenFileDialog1
.Title = "File Browser"
.Filter = "Media Files (*.wmv;*.mp3)|*.wmv;*.mp3"
.FileName = ""
.CheckFileExists = True
End With
If OpenFileDialog1.ShowDialog = _
Windows.Forms.DialogResult.OK Then
AxWindowsMediaPlayer1.URL = _
OpenFileDialog1.FileName
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnBack.Click
Me.Hide()
ECoach.Show()
答案 0 :(得分:0)
要开始/停止......您必须使用MediaPlayerCtrl.Ctlcontrols.OrderYouWish
。那就是:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnBack.Click
AxWindowsMediaPlayer1.Ctlcontrols.stop()
Me.Hide()
ECoach.Show()
End Sub