使用directshow在picturebox中播放视频 [英] Play video in picturebox with directshow

查看:100
本文介绍了使用directshow在picturebox中播放视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用DirectShow播放照片和视频时遇到一个小问题。我的意思是......



我按照在线下载的一个例子来选择要播放的文件,它可以毫无问题地预先生成。据说它在PictureBox上。研究代码,我发现它确实创建了一个窗口ActiveMovieWindow,播放视频,然后选择PictureBox作为该窗体的父容器。在建立ActiveMovieWindow之前,删除标题栏和控件最小化,最大化和关闭。在视觉上它看起来不错,好像在PictureBox上重现一样。

问题是我无法访问PictureBox的事件MouseClick / MouseDoubleClick,因为ActiveMovieWindow形式没有响应它们。 br $> b $ b

我的问题,我请求帮助,我是如何在不使用ActiveMovieWindow的情况下在PictureBox上播放视频的?如果这不可能,那么我如何检测和MouseDoubleClick MouseClick ActiveMovieWindow表格?



提前感谢您的帮助。

I have a small problem when playing photos and videos with DirectShow. I mean ...

I followed an example downloaded online in which selecting the file to play, it preproduce without problem. Supposedly it does on a PictureBox. Researching on the code, I see that it really does is create a window ActiveMovieWindow, where played the video and then selects the PictureBox as parent container of that form. Before establishing the ActiveMovieWindow removing the title bar and controls minimize, maximize and close. Visually it looks good, as if reproduced on the PictureBox.
The problem is that I have no access to the event "MouseClick / MouseDoubleClick" of the PictureBox, because the form ActiveMovieWindow not respond to them.

My question, and I ask for help, is how I can play the video on the PictureBox without using ActiveMovieWindow? If this is not possible, then how I can detect and MouseDoubleClick MouseClick ActiveMovieWindow form?.

Thank you in advance for your help.

推荐答案

通过访问 Handle 属性来获取 PictureBox 的句柄。然后p / invoke directshow,将句柄作为参数传递。不仅 PictureBox ,你也可以在标签上做同样的事情,这样更简单。 (WinForms相当于WinAPI STATIC控件)。
Get the handle of the PictureBox by accessing it's Handle property. Then p/invoke directshow, passing the handle as parameter. Not only PictureBox, you can also do the same on a Label which is more simpler. (WinForms equivalent of WinAPI STATIC control).


这篇关于使用directshow在picturebox中播放视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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