سؤال

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.

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.

There are 2 things to notice here :

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

  2. 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.

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

Any suggestions would be appreciated.

Thanks a lot folks.

هل كانت مفيدة؟

المحلول

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

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!

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.

That was it!

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top