C# control to display camera video with DirectShow.Net

守給你的承諾、 提交于 2019-12-22 00:24:00

问题


I want to use DirectShow.Net to capture the stream from a webcam.

What type of UI control can I use to display a the webcam video capture?

I have seen an example that uses the whole window of a Form, but are there any other controls I can use: a Panel, PictureBox?


回答1:


yes. you can use pictureboxes or forms or panels.

You need to call and use IVideoWindow. you can cast the directshow.net graph that is streaming/capturing to the IVideoWindow and then you can set it to being owned by whatever object you want to put your video stream into. just have to give it the objects handle and then set its windowstyle to child of the parent object.

IVideoWindow videowindow;
videowindow = FirstGraph as IVideoWindow;
videowindow.put_Owner(panel1.Handle);
videowindow.put_WindowStyle(WindowStyle.Child | WindowStyle.ClipChildren);



回答2:


http://channel9.msdn.com/Forums/TechOff/93476-Programatically-Using-A-Webcam-In-C - its not formatted, but it has a code that actually implants what you need.



来源:https://stackoverflow.com/questions/6737581/c-sharp-control-to-display-camera-video-with-directshow-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!