0
我正在使用DirectShow.NET庫[http://directshownet.sourceforge.net/],我使用下面的代碼來顯示視頻流。IVideoWindow界面在UserControl中沒有正確顯示視頻幀
videowindow.put_Owner(handle);
videowindow.put_WindowStyle(WindowStyle.Child | WindowStyle.ClipChildren);
videowindow.put_WindowState(DirectShowLib.WindowState.Show);
注:手柄是System.Windows.Forms.UserControl處理[這 - >柄]
的問題是:
- 在我的用戶控制的視頻幀沒有正確顯示:我看到視頻幀的一半爲 ,另一半在屏幕外。
- 此外,當我縮放我的用戶控件,視頻流幀不是 縮放。
什麼可能導致這種情況?我該如何解決它?
更新:
基於羅馬答案我添加以下代碼:
videoWindow.SetWindowPosition(this.ClientRectangle.Left,
this.ClientRectangle.Top,
this.ClientRectangle.Width,
this.ClientRectangle.Height);
,現在我可以看到視頻幀在我的用戶控件矩形正常....
你正在設置'IVideoWindow.SetWindowPosition'嗎?您也有責任在窗口布局更改時對其進行更新。 –
羅馬,寫你的評論作爲答案,我會接受它。感謝羅馬河 – Novalis