BCS
BCS

Reputation: 78545

How to draw on top of winforms controls with transparency?

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.

Upvotes: 0

Views: 933

Answers (2)

BCS
BCS

Reputation: 78545

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.

Upvotes: 1

lc.
lc.

Reputation: 116468

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...

Upvotes: 0

Related Questions