WPF中托管的VLC.DotNet控件 [英] VLC.DotNet Control Hosted in WPF

查看:595
本文介绍了WPF中托管的VLC.DotNet控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经将 VLC.DotNet 窗口控件托管在WPF窗口内的WindowsFormsHost元素中.之所以这样做,而不是使用Vlc.DotNet WPF控件,是因为WinForms版本的性能是WPF版本的两倍.

I have hosted the VLC.DotNet windows Control in a WindowsFormsHost element, inside a WPF window. The reason behind doing this, instead of using Vlc.DotNet WPF control is because the performance of the WinForms version is twice better than the WPF version.

无论如何,除了一个令人讨厌的细节,一切都很好.在 WinForms应用中使用WinForms版本时,渲染的视频将完全适合控件;但是,在WindowsFormsHost元素中使用相同的控件会导致视频以原始大小呈现,而不适合该控件.

Anyway, everything works fine, except for one annoying detail; When using the WinForms version inside a WinForms App, the rendered video will exactly fit the control; However, using the same control inside a WindowsFormsHost element, causes the video to be rendered as it's original size and not fitted to the control.

这里有两件事要注意:

  1. WinForms控件是完全相同的,所以在我看来,这种行为与之无关.

  1. The WinForms control is exactly the same, so in my opinion, this behavior could not be related to it.

使用 Spy ++ ,我设法查看了在WinForms应用程序中使用控件时,渲染视频的矩形大小与控件本身的矩形大小完全相同,但是在WPF App中使用时,视频的重响(由VLC渲染,我对此没有控件)与控件的大小不同.相反,它的大小与视频本身的大小相同.

Using Spy++ I've managed to see when the control is used inside a WinForms App, the rectangle of the rendered video is exactly the same size as the rectangle of the Control itself, But when used in WPF App, the recatngle of the video (which is rendered by VLC and I have no control on it) is not the same size as the control. Instead, it has the same size as the video itself.

对于WPF为什么显示这种奇怪行为,有人有什么特别的想法吗?

Anyone has any particular ideas on why WPF is showing this strange behavior?

任何建议将不胜感激.

Any suggestions would be appreciated.

感谢很多人.

推荐答案

最后,我设法找出导致问题的原因并解决了!

Finally, I managed to find out what was causing the problem and resolved it!

我应该承认,在这些情况下,这个问题甚至与想到的头2000件事没有太大关系!取而代之的是,这与最荒唐的事情有关,从未引起我的注意!好吧,正如他们所说,它始终位于您最后看的地方!

I should confess that the problem was not even remotely related to the first 2000 things that comes to mind in these situations! Instead, it was related to the most ridiculous thing that never happened to catch my eye! Well, as they say, it's always in the last place you look!

听起来可能很奇怪,但问题与视频缩放有关!我需要缩放视频,显然,当您在vlc中设置缩放比例时,视频将不再适合容器.

As weird as it may sound, the problem was related to video scaling! I needed to scale the video and apparently, when you set scaling in vlc, the video wont get fitted to container anymore.

就是这样!

这篇关于WPF中托管的VLC.DotNet控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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