The idea
I am making a Windows.Forms application using C#. There are three AXIS M7001 video encoders providing H264-converted stream over RTSP protocol. I want to take these streams (the cameras are put together), cut them properly and get a single wide-angle live video, on which I'd be able to add pictures and paint lines. So i need a way to paint and update dozens of lines on top of all three streams, and to put a single picture with transparent background.
The problem
There is a SDK provided by Axis (Axis Media Control SDK, AMC), which is actually a single library with a class inherited from the Control class. They provide a couple of methods for drawing on the AMC object, which support just graphic primitives like lines, ellipses and rectangles.
The drawing methods by AMC do not let me make an overall drawing on top of the final video stream. It also doesn't support adding overlaying pictures.
The AMC control does not let me put anything transparent in front of it. Either the background of the panel/picturebox becomes opaque (taken from Form.BackColor) or both the background and foreground get hidden.
The Google
I've tried the following idea with overriding Panel and PictureBox
protected override CreateParams CreateParams
{
get
{
CreateParams createParams = base.CreateParams;
createParams.ExStyle |= 0x00000020; // WS_EX_TRANSPARENT
return createParams;
}
}
protected override void OnPaintBackground(PaintEventArgs e)
{
// Do not paint background.
}
It lets me put a transparent Panel on top of the AMC and handle mouse events, but if I put something on the panel or add some OnPaint event, I can't see it. Trying overriden PictureBox has no result.
Of course, anything like
BackColor = Color.Transparent;
doesn't work either.