سؤال

I've built a simple form that can play a video using functionality from the direct show library. The video plays in a panel in a UserControl that is housed in a pretty simple form. I'm wondering if there's any way for the video to scale it's size along with the form. I've tried anchoring the control in the form (using the dock) and setting the auto re size to true. I feel like there should be some simple solution but it's not coming to me. I understand this is very general but I would greatly appreciate any sort of help along with whether or not this is possible.

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

المحلول

You need to update video position along with form resizes (IVMRWindowlessControl9.SetVideoPosition and similar). DirectShow.NET samples do it:

\Samples\VMR9\BitmapMixer\MainForm.cs:

private void MainForm_ResizeMove(object sender, EventArgs e)
{
    if (windowlessCtrl != null)
    {
        int hr = windowlessCtrl.SetVideoPosition(null,
           DsRect.FromRectangle(this.ClientRectangle));
    }
}
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top