0

I have an app with a bunch of controls in it and I want to place a set of cross hairs on top of it. My first attack used a PictureBox and ran into this problem. The solution that fellow proposes, seems a bit... verbose for what I need.

Is there a simple way draw on top of my form? Note that I don't even need the drawing to be part of a control as it doesn't need to do anything but just be there.

Andrew Morton
  • 22,953
  • 9
  • 55
  • 76
BCS
  • 71,616
  • 66
  • 178
  • 288

2 Answers2

1

This eventually worked. I had to play some games though because most of the controls I wanted to draw on were not where it expected them to be.

Also, it ran into issues when controls were moved; it failed to redraw and stuff moved with the underlying control. This was fixed by forcing invalidation from the move event for anything that might move.

BCS
  • 71,616
  • 66
  • 178
  • 288
0

Does a PictureBox with a transparent image have the same problem as a Panel with BackColor set to Transparent? I'm thinking you could have a PictureBox with the crosshair image in it and move that around, instead of drawing it yourself...

lc.
  • 109,978
  • 20
  • 153
  • 183
  • PictureBox is only transparent re it's parent. As far as other controls go, it paints over them with whatever it's parent would have panted there. There is a picture of that at the top of the link in the question. – BCS Jul 14 '09 at 07:08