I use this sample code https://www.codeproject.com/Articles/2632/DirectShow-MediaPlayer-in-C And just need a little change.i try to add picturebox in front of IVideoWindow but the picturebox is alwayse behind IVideoWindow.i use parent and bringfront but non of them work.i just need to show picture in front of video as logo or watermark.
-
1Video plays back in a video overlay, allows the player to offload the heavy lifting of decoding the video stream and blasting the pixels to the GPU. You can only get ahead of an overlay by creating an overlay yourself. Easy to do in Winforms, use the TransparencyKey property. Sample code to keep the form in the right place [is here](http://stackoverflow.com/a/4503371/170340). – Hans Passant Apr 13 '17 at 21:43
2 Answers
DirectShow
and the whole package that you are working with (i.e. Windows Forms) is really old. First let me tell you what happens.
DirectShow
and all other DirectX
graphical packages like Direct3D
work directly with graphics card and draw directly on your monitor in layers that windows is not even aware of, let alone draw something over it. So it can't be done unless you render what you want to show using DirectX in the same device that you have created the initial window.
Ok, then what is the solution?
I don't know what you are trying to do but many years back I used WPF and it's WritableBitmap
to render images received from an IP camera to screen. WPF works internally with DirectX which makes it fast and efficient. You also have the ability to write over it since it's just a normal control and you can do whatever you want with it.
Hope it helps :)

- 3,809
- 3
- 32
- 44
This method of video playback uses certain capabilities which do not mix well with WinForms, so you cannot put a control in front of video and combine this in accurate UI.
This is behavior by design. You have to either extract video frames and present them using regular WinForms API, or otherwise apply your watermark using DirectShow.NET and display combined video, with original video frames and your logo merged in.
See related questions on overlaying displayed video:
DirectShow.NET's BitmapMixer sample might be of some help:
BitmapMixer is an example of how to draw things over a video using VMR9.
This sample is mainly built around the IVMRMixerBitmap9 interface. This interface accept bitmaps as a GDI Device Context or as a Direct3D Surface. The main advantage of the Direct3D Surface is that it enables the use of true alpha transparency. GDI DC don't support alpha bitmap and transparency is accomplished by using color keying.