使用DirectShow.net在C#的图片框中显示视频捕获 [英] Displaying video capture in a picturebox in C# using directshow.net

查看:115
本文介绍了使用DirectShow.net在C#的图片框中显示视频捕获的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经编译了示例PLayCap( http://sourceforge.net/projects/directshownet/files/)从C#中的directshow.NET( http://directshownet.sourceforge.net/)网站中获取.

PLayCap-此应用程序为第一个视频捕获设备创建预览窗口.

尽管程序运行良好,但我需要在表单中添加按钮.我不能这样做,因为视频捕获会显示在整个表单上.我希望将其显示在一个图片框上,例如picturebox1.这样我就可以稍微向上移动picturebox1并放一些按钮.

有人知道怎么做吗?

非常感谢

Hi, I have compiled the sample PLayCap (http://sourceforge.net/projects/directshownet/files/) from the directshow.NET (http://directshownet.sourceforge.net/) website in C#.

PLayCap - This application creates a preview window for the first video capture device.

Although the program works fine, i need to add buttons to the form. I cannot do that since, the video capture is displayed on the entire form. I want it to be displayed on a picturebox, for instance picturebox1. So that I can move the picturebox1 a little up and put some buttons.

Does anyone know how to do that ?

Many Thanks

推荐答案

好吧,只是快速查看源代码,DirectShow使用了IVideoWindow.

在源代码中,它将IVideoWindow的所有者设置为该窗体.

相反,您可以使用面板来更改行:

Well, just quickly looking at the source code, DirectShow uses an IVideoWindow.

In the source code, it sets the owner of the IVideoWindow to the form.

You could, instead, probably use a panel and just change the line:

hr = this.videoWindow.put_Owner(this.Handle);







to

hr = this.videoWindow.put_Owner(this.panel1.Handle);



然后,您还必须更改ResizeWindow例程以使用面板的大小,而不是窗体的clientSize的大小.



Then, you would also have to change the ResizeWindow routine to use the size of the panel, instead of the size of the form''s clientSize.


这篇关于使用DirectShow.net在C#的图片框中显示视频捕获的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆