0

I am using DirectShow.NET library [ http://directshownet.sourceforge.net/ ] and I use below code in order to show video streams.

videowindow.put_Owner(handle);
videowindow.put_WindowStyle(WindowStyle.Child | WindowStyle.ClipChildren);
videowindow.put_WindowState(DirectShowLib.WindowState.Show);

Note: The handle is System.Windows.Forms.UserControl handle [ this->Handle]

The problem is that:

  • In my user control the video frames are not shown properly: I see half of the video frame and the other half is out of screen.
  • Also when I scale my user control, the video stream frames are not scaled.

What may cause this ? How can i fix it?

Update:

Based on Roman Answer I added following code:

videoWindow.SetWindowPosition(this.ClientRectangle.Left,
                this.ClientRectangle.Top,
                this.ClientRectangle.Width,
                this.ClientRectangle.Height);

And Now I can able to see video frame in my user control rectangle properly....

Novalis
  • 2,265
  • 6
  • 39
  • 63
  • Are you setting `IVideoWindow.SetWindowPosition`? You are also responsible to update it when layout of your window changes. – Roman R. May 03 '12 at 09:30
  • Roman, write your comment as an answer, I will accept it. Thanks Roman R. – Novalis May 03 '12 at 10:50

1 Answers1

1

Additionally to putting video renderer's window as a child control and providing window stypes, you should be setting IVideoWindow.SetWindowPosition. You are also responsible to update it when layout of your window changes.

Roman R.
  • 68,205
  • 6
  • 94
  • 158