views:

1026

answers:

3

Hey everyone,

Is it possible for me to set the opacity of a button or textbox? I know that you can set the opacity for a form, but I'm not so sure about a button or textbox.

Thanks

A: 

Just set the Alpha level in your RGBA setting for the color of the control. The code will look something like this:

Control.Backcolor = Color.FromArgb(255, 255, 255, 255)

The first value passed into the FromArgb method is the Alpha. A high value will mean high opacity whereas a low value will mean a high transparency. You may need to set the control's Forecolor property as well if you want that to be transparent, too.

Sonny Boy
WHere is RGBA on Visual Basic 2008 ?
Kevin
Please see my edit. I have an example now listed.
Sonny Boy
A: 

No, opacity is not a button property, it's inherited from whatever the form is set to. I don't know of any way of doing this short of "faking it" by using an image of a button faded to appear translucent.

Jeremy Morgan
A: 

On your form that the control rests on, set TransparencyKey to a color (ex: Fuchsia), then make your control's background color as Fuchsia. You're welcome.

KasteR