What I want to achieve is a semi-transparent background that covers the screen. And then be able to draw non-transparent brushes on top of it.
What I have tried is to have a form with the size of the screen, then setting it's color and setting this.opacity = 0.5
. However this affects all brushes in the form.
Ive also tried setting the background color to Color.Transparent, and then drawing an additional brush that covers the screen with opacity 0.5 before I then draw the opaque brushes... However the background becomes opaque as well.
Even though the style flag is set (ControlStyles.SupportsTransparentBackColor, true)
I know I can achieve this by having an additional form. One form for the transparent background and one for the opaque foreground, but isn't that overkill?
Is there a better way?
Update 1: Trying what is suggested in the comments.
Current state: Form1: the main program, calls for the 'overlay' to show, which is: Form2: Overlay background (semi-transparent black) and, Form3: Overlay foreground, this is where the user draws.
Form 1 and 2 works as indended, however Form3 refuses to work with transparency. If I set
this.BackColor = Color.Lime;
this.TransparencyKey = Color.Lime;
then the performance drops and the program lags heavily (although it does become transparent).
Ideally I would want to use this.BackColor = Color.Transparent;
however that doesn't have any effect (solid background, no alpha).
Note that the form covers the screen and the background is usually the desktop. Maybe that's why it doesn't work?