如何在c#中更改windows media player的默认语言设置?

时间:2016-08-03 05:59:56

标签: c# audio wmp

我正在建立一个音乐播放器,因此我选择使用Window Media Player库:现在我卡住了因为我希望在listBox中显示歌曲的名称并实时更改歌曲但我不知道怎么做我存储文件夹中的歌曲,因此当音乐播放器播放来自Url的歌曲时。

代码段

 private void PlaylistMidday(String folder, string extendsion)
 {
    string myPlaylist = "D:\\Music\\The_Chemical_Brothers-Do_It_Again-(US_CDM)-2007-SAW\\";
    ListView musicList = new ListView();

    WMPLib.IWMPPlaylist pl;

    WMPLib.IWMPPlaylistArray plItems;

    plItems = player1.playlistCollection.getByName(myPlaylist);

    if (plItems.count == 0)

        pl = player1.playlistCollection.newPlaylist(myPlaylist);

    else

        pl = plItems.Item(0);

    DirectoryInfo dir = new DirectoryInfo(folder);

    FileInfo[] files = dir.GetFiles(extendsion,  SearchOption.AllDirectories);

    foreach (FileInfo file in files)
    {

        string musicFile01 = file.FullName;

        string mName = file.Name;

        ListViewItem item = new ListViewItem(mName);

        musicList.Items.Add(item);

        WMPLib.IWMPMedia m1 = player1.newMedia(musicFile01);

        pl.appendItem(m1);

    }

    player1.currentPlaylist = pl;

    player1.Ctlcontrols.play();

}

在加载时我决定播放“myPLaylist”的歌曲,所以我想你知道如何在列表框中显示我的播放列表的歌曲,当我点击所选项目时歌曲会被更改吗? / p>

1 个答案:

答案 0 :(得分:0)

你可以使用((IWMPcontrols)player.ctlcontrols).setAudioLanguage

More Details