How can I make transparent control over DirectShow video?
I have a VideoControl that displays a video using DirectShow - it is set as the owner of the IVideoWindow. I have another AreaControl that is supposed to show a dashed rectangle above the video control. The AreaControl is set to be transparent with SetStyle (ControlStyles.SupportsTransparentBackColor, true). If I place the AreaControl on top of any other control, it works as expected, showing a dashed rectangle above the controls behind it. But when I place the dashed rectangle control over the video control, the AreaControl is filled with the VideoControl BackColor.
What do I need to do to display the video using an AreaControl with a dashed rectangle overlaid on it? Is there a way to get the VideoControl to draw itself from the video and not just draw its BackColor?
source to share
As far as I know, there is no way to do what you want to do directly. The problem is in the implementation of the transparent style of the control. A control with this style attribute basically just draws, which makes it transparent behind it. (This is actually not transparent at all.)
The only solution that comes to my mind is to use a window (form) and put a control in it. A shape can be made transparent by setting its Opacity property to less than 1.0. A value of 0.0 will be completely transparent (read: Invisible). The dotted border should be completely black. With an opacity fe 0.4, gray appears.
Also, you may be in luck with the TransparencyKey Property of the form. Setting this to white might have the desired effect, but I haven't tested this one.
In any case, the Form must be completely borderless. You may need to add some code to change the shape when the video shape is moved.
source to share