I am using a 3rd party ActiveX video control in my project. The control can be pointed at a net camera and it shows the video stream. Works great… that’s not my problem.
My problem is that I am trying to draw an image on top of that control and all I get is my image behind the ActiveX control. The ActiveX control is currently just plopped into the middle of a Windows form. I have overridden the Form’s OnPaint() method like this:
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
e.Graphics.DrawImage(Properties.Resources.ProgressBar, new Point(300, 300));
}
My image does get drawn on the form, but it is behind the ActiveX. I used the starting point of (300,300) to make my graphic off center intentionally so that I could see part of it peeking out if it got drawn being the ActiveX.
How can I get my image in front of the ActiveX control?
Your question is equivalent to “why when I draw in my window the child window of it is drawn above my drawing” (assuming it ActiveX is not windowless control, which is unlikely).
You should think what you really trying to achieve and draw accordingly. If you want to draw on someone else window – subclass and paint yourself. If you just need to cover part of the image – create another window and place above the other child.