带有 directshow 视频渲染器的移动面板
我有几个面板,它们绑定了不同的 directshow IVideoWindow 句柄,以便视频显示在面板内(WindowStyle 属性为:Child、ClipSiblings、ClipChildren、Caption) 现在我想移动这些面板,但我只能设法当视频内容未填满整个面板并且我在空白面板空间上单击并按住鼠标按钮时移动它们。我可以在面板中移动视频窗口,但当然它们只能在各自的面板空间内移动。
有没有办法将视频窗口内容直接绑定到面板,例如,当我单击并按住视频窗口菜单栏时,整个面板的内容可以自由移动?
提前致谢。
忘了说了,这是c#里的。
I have a few panels with different directshow IVideoWindow handles bound to them so that the videos get shown inside the panels (WindowStyle properties are: Child,ClipSiblings,ClipChildren,Caption) Now I would like to move these panels around but I can only manage to move them when the video content is not filling the entire panel and I'm clicking+holding mouse button on the empty panel space. I can move the video windows around in the panels but of course they only move inside their respective panel space.
Is there a way to bind the video window content directly to the panel , for example the entire panel with content moves freely around when I click+hold the videowindow menu bar?
Thanks in advance.
Forgot to mention,this is in c#.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我使用视频混合渲染器 9 并将其绑定到用户控件。我已将VMR9设置为无窗口模式,然后将IVMRWindowlessControl9界面上的视频剪辑窗口设置为我的用户控件的句柄。每当面板大小调整时,我还使用 IVMRWindowlessControl9.GetNativeVideoSize、IVMRWindowlessControl9.SetAspectRatioMode 和 IVMRWindowlessControl9.SetVideoPosition 将视频设置为完全填充面板。当包含我的用户控件的表单四处移动时,视频也会随之移动。这一切都是通过 C# 和 DirectShow.NET 完成的。
编辑添加示例代码:
I use the Video Mixing Renderer 9 and have it tied to a user control. I have set the VMR9 to Windowless mode and then set the video clipping window on the IVMRWindowlessControl9 interface to the handle of my user control. I also set the video to fill the panel completely, using IVMRWindowlessControl9.GetNativeVideoSize, IVMRWindowlessControl9.SetAspectRatioMode, and IVMRWindowlessControl9.SetVideoPosition whenever the panel gets resized. When the form that contains my user control gets moved around, the video follows along. This is all done with C# and DirectShow.NET.
Edited to add sample code:
我终于解决了这个问题,我简直不敢相信我是多么愚蠢。我遗漏了
hr = videoWindow.put_MessageDrain(hWin.Handle);
行,当然视频窗口不会“监听”面板。
I solved it finally and I can't believe how silly I was. I left out the
hr = videoWindow.put_MessageDrain(hWin.Handle);
line , of course the videowindow wouldnt "listen" to the panel.