
你得放上一个可以播放视频的控件才行,
Public Class 影音播放
Private Sub Button1_Click(ByVal sender As SystemObject, ByVal e As SystemEventArgs) Handles Button1Click
OpenFileDialog1InitialDirectory = "F:\Music"
OpenFileDialog1Filter = "mp3 文件(mp3)|mp3|CD音频文件(wav)|wav|" & "视频(asf)|asf|所有文件()|"
If OpenFileDialog1ShowDialog = WindowsFormsDialogResultOK Then
AxWindowsMediaPlayer1URL = OpenFileDialog1FileName
ListBox1ItemsAdd(OpenFileDialog1FileName)
End If
End Sub
Private Sub Button2_Click(ByVal sender As SystemObject, ByVal e As SystemEventArgs) Handles Button2Click
If Button2Text = "播放" Then
AxWindowsMediaPlayer1Ctlcontrolspause()
Button2Text = "暂停"
Else
AxWindowsMediaPlayer1Ctlcontrolsplay()
Button2Text = "播放"
End If
End Sub
Private Sub 打开ToolStripMenuItem_Click(ByVal sender As SystemObject, ByVal e As SystemEventArgs) Handles 打开ToolStripMenuItemClick
Button1_Click(sender, e)
End Sub
Private Sub Button3_Click(ByVal sender As SystemObject, ByVal e As SystemEventArgs) Handles Button3Click
AxWindowsMediaPlayer1Ctlcontrolsstop() '停止
AxWindowsMediaPlayer1CtlcontrolscurrentPosition() = 0 '重新开始
AxWindowsMediaPlayer1URL = ""
End Sub
Private Sub 打开目录ToolStripMenuItem_Click(ByVal sender As SystemObject, ByVal e As SystemEventArgs) Handles 打开目录ToolStripMenuItemClick
If FolderBrowserDialog1ShowDialog = WindowsFormsDialogResultOK Then
Dim fi As IOFileInfo
Dim dir As IODirectoryInfo = New IODirectoryInfo(FolderBrowserDialog1SelectedPath)
Dim file As String
For Each fi In dirGetFiles("mp3")
file = fiFullName
ListBox1ItemsAdd(file)
Next
End If
End Sub
Private Sub 关闭ToolStripMenuItem_Click(ByVal sender As SystemObject, ByVal e As SystemEventArgs) Handles 关闭ToolStripMenuItemClick
''关闭
If MessageBoxShow("请确定你要关闭吗?", "关闭", MessageBoxButtonsOKCancel) = WindowsFormsDialogResultOK Then
Close()
Else
Return
End If
End Sub
Private Sub Timer1_Tick(ByVal sender As SystemObject, ByVal e As SystemEventArgs) Handles Timer1Tick
HScrollBar1Value = AxWindowsMediaPlayer1CtlcontrolscurrentPosition
End Sub
Private Sub HScrollBar1_Scroll(ByVal sender As SystemObject, ByVal e As SystemWindowsFormsScrollEventArgs) Handles HScrollBar1Scroll
AxWindowsMediaPlayer1CtlcontrolscurrentPosition() = HScrollBar1Value
End Sub
Private Sub ListBox1_DoubleClick(ByVal sender As SystemObject, ByVal e As SystemEventArgs) Handles ListBox1DoubleClick
If ListBox1Text < "" Then
AxWindowsMediaPlayer1URL = ListBox1SelectedItemToString
End If
End Sub
Private Sub 影音播放_Load(ByVal sender As SystemObject, ByVal e As SystemEventArgs) Handles MyBaseLoad
End Sub
End Class
这个当初我跟着网上做的,你看看不知道行不行
可以使用简单些的软件来 *** 作的。试试《梨涡视频转换器》
*** 作过程:把视频添加进软件里面,然后点击“视频编辑”,这里可以实现截取的功能哦,可以设置开始时间和结束时间,也能手动拖动截取, *** 作很简单,望采纳。
以上就是关于VB如何打开一个视频文件全部的内容,包括:VB如何打开一个视频文件、VB 怎么截取视频文件中的一段、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)