zoukankan      html  css  js  c++  java
  • AxWindowsMediaPlayer创建、添加播放列表(C#)

    // 创见打开对话框对象实例
                OpenFileDialog openFileDialog = new OpenFileDialog();

                //设置为可以打开多个文件
                openFileDialog.Multiselect = true;

                //设置打开文件格式
                openFileDialog.Filter = "Mp3文件|*.mp3|Wav文件|*.wav|Wma文件|*.wma|Wmv文件|*.wmv|所有格式|*.*";

                //判断是否单击确定按钮
                if (openFileDialog.ShowDialog() == DialogResult.OK)
                {
                    //建立播放列表,名字为aa
                    axWindowsMediaPlayer1.currentPlaylist = axWindowsMediaPlayer1.newPlaylist("aa", "");

                    //遍历打开的集合
                    foreach (string fn in openFileDialog.FileNames)
                    {
                        //添加播放列表
                        axWindowsMediaPlayer1.currentPlaylist.appendItem(axWindowsMediaPlayer1.newMedia(fn));
                    }
                }
                //播放
                axWindowsMediaPlayer1.Ctlcontrols.play();
            }

    *************************************************************************

    创建一个音乐对象的LIST来存放 对这个List进行操作
    播放的时候用wmpPlayer.currentMedia.sourceURL获取List中具体的音乐

    **************************************************************************

    c#直接有mediaplayer工具,可在工具箱里添加。播放音乐列表的代码:  

         if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                axWindowsMediaPlayer1.currentPlaylist = axWindowsMediaPlayer1.newPlaylist("fy","");

                foreach (string strFile in openFileDialog1.FileNames)
                {
                   axWindowsMediaPlayer1.currentPlaylist.appendItem(axWindowsMediaPlayer1.newMedia(strFile));
                    axWindowsMediaPlayer1.Ctlcontrols.play();
                }

           }

    ******************************************************

  • 相关阅读:
    get ,post接口测试
    jmeter接口测试 day11
    接口笔记,day01
    python 列表、元组 达内笔记
    linux 笔记达内03
    linux 笔记达内02
    linux 笔记达内01
    Linux/Unix系统下常用的命令
    PageObjectModel页面对象模型(03)
    selenium,实现ECShop后台登录模块测试代码(2)
  • 原文地址:https://www.cnblogs.com/wanzhongjun/p/6263485.html
Copyright © 2011-2022 走看看