tags:

views:

83

answers:

2

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