I want to change controls opacity depending on the mouse position on the form, is this possible?
+3
A:
If the control supports transparent backgrounds, you can use Color.FromArgb()
to set a translucent color:
button1.BackColor = Color.FromArgb(100, Color.Red);
Depending on how you want this to work, you would vary the alpha value based on mouse position (to between 0 and 255).
Jon B
2010-01-08 20:08:54
A:
Jon B is right, but you can also do it in the Properties window of the WinForms designer. For example, setting the background color to 150, 255, 255, 255
will make the background a translucent white. The designer translates this into Color.FromArgb(150, 255, 255, 255)
for you.
Joel Mueller
2010-01-08 20:33:22