Wpf C#项目中的WinForms WMP [英] WinForms WMP in Wpf C# Project

查看:58
本文介绍了Wpf C#项目中的WinForms WMP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

在我的小型媒体播放器中我在WPF中使用winforms wmp



我的问题是一切都很好,除了当我使用



Hi all
In my small mediaplayer i am using a winforms wmp in my WPF

My prob is that all is fine except when i use

private void axWindowsMediaPlayer_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e)
{
    if (myPlayList.Items.Count >= 1)
        if (e.newState == (int)WMPLib.WMPPlayState.wmppsMediaEnded)
        {
            myPlayList.Items.Remove(myPlayList.Items[0]);
            string CurrentCell = ((DataItem)myPlayList.Items[0]).Column3;
            GetFirstItemOfPlayList.Content = (CurrentCell);
            player.URL = CurrentCell;
            player.Ctlcontrols.play();






        }
}





Player.url是正确的 - 但它不会播放URL



i有一个带有上述代码的取消按钮,并且工作正常



任何帮助将不胜感激



欢呼



Tony



the Player.url is correct - but it wont play the URL

i do have a cancel button with the above code and that works fine

any help would be greatly appreciated

cheers

Tony

推荐答案

如果没有真正令人信服的理由,使用WPF-Forms互操作并不好。这些库的性质非常不同,WPF基于DirectX,几乎与Windows API无关,实际上更适合于视频。



更好地使用为WPF设计的组件: System.Windows.Media.MediaPlayer

http://msdn.microsoft.com/en-us/library/system.windows.media.mediaplayer.aspx [ ^ ] 。



-SA
It's not good to use WPF-Forms interop without a really convincing reason. The too libraries have very different nature, and WPF is based on DirectX, has almost nothing to do with Windows API and is actually much more suitable for video due to this fact.

Better use the component designed for WPF: System.Windows.Media.MediaPlayer:
http://msdn.microsoft.com/en-us/library/system.windows.media.mediaplayer.aspx[^].

—SA


嗨SA

谢谢你你的帮助



干杯



Tony
Hi SA
Thank you for your help

Cheers

Tony


这篇关于Wpf C#项目中的WinForms WMP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆