我播放视频使用axwindowsmediaplayer控件,在控件的enter事件里添加如下代码:
Private Sub AxWindowsMediaPlayer1_Enter(sender As Object, e As EventArgs) Handles AxWindowsMediaPlayer1.Enter
Try
Dim playings As String = Me.AxWindowsMediaPlayer1.Ctlcontrols.currentPositionString ’获取播放进度
If playings = playlength Then ’如果当前进度等于视频总时长
Isplayed = True ’设置已播放状态为true
Me.Close() ’关闭窗体
End If
Catch ex As Exception
End Try
End Sub
另外我也添加了计时器并添加如下代码(计时间隔为500):
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
If Me.AxWindowsMediaPlayer1.playState = 1 Then ’如果播放状态显示为已停止
Isplayed = True ’设置已播放状态为true
Me.Close() ’关闭窗体
End If
End Sub
但两种方法都没有作用,请问还有更好的方法吗?
@我爱电脑编程 @Nukepayload2
Private Sub AxWindowsMediaPlayer1_Enter(sender As Object, e As EventArgs) Handles AxWindowsMediaPlayer1.Enter
Try
Dim playings As String = Me.AxWindowsMediaPlayer1.Ctlcontrols.currentPositionString ’获取播放进度
If playings = playlength Then ’如果当前进度等于视频总时长
Isplayed = True ’设置已播放状态为true
Me.Close() ’关闭窗体
End If
Catch ex As Exception
End Try
End Sub
另外我也添加了计时器并添加如下代码(计时间隔为500):
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
If Me.AxWindowsMediaPlayer1.playState = 1 Then ’如果播放状态显示为已停止
Isplayed = True ’设置已播放状态为true
Me.Close() ’关闭窗体
End If
End Sub
但两种方法都没有作用,请问还有更好的方法吗?
@我爱电脑编程 @Nukepayload2