| 网站首页 | VB.Net实例分析 | .Net技术文摘 | 下载中心 | VB.Net书籍笔记 | .Net源码 | VBS脚本与组件调用 | Windows2008技术文摘 | 给我们留言 | 
最新公告:

  没有公告

您现在的位置: 乐博网 >> VB.Net实例分析 >> 多媒体编程 >> 实例分析正文
最新推荐 更多内容
VB.Net调用mediaplayer播放器的实例
VB.Net调用mediaplayer播放器的实例
作者:Ilu    来源:乐博网整理     更新时间:2009-9-3

vb.net调用mediaplayer的WMP.DLL从本地或者远程服务器上播放avi,wmv等多媒体文件

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim opf As New OpenFileDialog()
        With opf
            .Filter = "Video Files|*.avi;*.wmv;*.flv|Audio Files|*.mp3;*.wma|M3U List|*.m3u|Images|*.jpg;*.bmp;*.png;*.gif|All files|*.*"
            .FilterIndex = 1
            .InitialDirectory = Environment.SpecialFolder.Desktop
        End With

        If opf.ShowDialog = Windows.Forms.DialogResult.Cancel Then
            Exit Sub   '更多vb.net源码和实例,请关注{乐博网 www.lob.cn}
        End If

        TextBox1.Text = opf.FileName
        AxWindowsMediaPlayer1.URL = opf.FileName
        setVolume()
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        AxWindowsMediaPlayer1.URL = "http://stream.pulsradio.com:5000"
         setVolume()
    End Sub

    Private Sub HScrollBar1_ValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles HScrollBar1.ValueChanged
        AxWindowsMediaPlayer1.settings.volume = HScrollBar1.Value
        Label1.Text = "Volume " & HScrollBar1.Value.ToString & "%"
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        If Not AxWindowsMediaPlayer1.Visible Then
            AxWindowsMediaPlayer1.Visible = True
        Else
            AxWindowsMediaPlayer1.Visible = False
        End If
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        AxWindowsMediaPlayer1.URL = "http://www.pulsradio.com/pls/puls-adsl.m3u"
        setVolume()
    End Sub

    Private Sub setVolume()
        HScrollBar1.Value = AxWindowsMediaPlayer1.settings.volume
        Label1.Text = "Volume " & HScrollBar1.Value.ToString & "%"
    End Sub
End Class

  • 上一篇:

  • 下一篇:
  • 【字体: 】【打印此文】【关闭窗口
      相关文章:(只显示最新16条)
    没有相关实例分析

    | 设为首页 | 加入收藏 | 联系站长 | | 友情链接 | 版权申明 |
    乐博网欢迎各种媒体转载我们的原创作品[转载请注明出处];我们鼓励更多VB.Net开发者一起加入研究与探讨;如发现文章访问错误、内容错误或版权疑问、内容有违相关法律(如涉及政治、色情、反动或散布虚假有害信息)等情况,请及时向我们举报,我们将及时纠正!
    联系邮箱:Shiny#vip.qq.com (#替换为@) QQ交流群: 40797788 [闽ICP备05014267号]