# Visual Basic > Slow Chat with the Microsoft Visual Basic team >  Are you ever going to make objects have a transparency option?

## Icyculyr

Hey everyone, this is something I often want to use, but am unable to..

I would really like seeing a transparency / opacity option in objects (such as picture boxes, perhaps buttons and labels as well)

I think it would be a very nice feature?

What does everyone else think?

Cheers :Big Grin:

----------


## RobDog888

I could see a variation of this as being an improvement in the background property of groupboxes or pictureboxes. Simply setting the property to Transparent only makes it inherit the parent container color and not be an actual "transparency". If you have a form with a backgroud image and a label above it, the labels Background color property of Transparent will only color the label as Control color and not allow the image that the label covers show through.

----------


## chris128

I assumed this kind of thing would be an option with the VS2008 controls what with Vista and its Aero Glass stuff coming out before VS2008....but unfortunately not  :Frown:

----------


## Kasracer

I'm curious as to why you would even want a button to be transparent? That seems like a big usability issue and annoyance to me though I guess there could be some application for it.

----------


## RobDog888

Labels, Picutreboxes, Panels and GroupBoxes are probably the most needed and feasible controls that would benefit from it.

----------


## Icyculyr

Meh, I was just thinking of objects that could make use of transparency...
some funky layout's I can imagine making:P

I would like VB to add it so you can set transparency / opacity % like with a form... that way you can have 20% transparent picture boxes etc..

If they added transparency it would make my day  :Big Grin: 

Cheers

----------


## PaulYuk_MS

Thanks - I've been passing this specific feedback on to the Windows Forms and Client teams.  

There's a trick you can use that will get you part of the way - setting alpha transparency on the background color.  This works with Labels, Panels, and similar containers.  It is not compatible with BackGroundImage settings or PictureBox -- you'd need to put the image behind the partially transparent panel on another control or on the form.  Using this you can arrive at a glassy look.  

Please try this trick and let me know what you think.  If you like it I could show you how to combine it with an extender property so it shows up off of controls (much like Tooltips).


    SetTransparency(Me.Panel1, 50)

    '..

    Public Sub SetTransparency(ByRef ctrl As Control, ByVal percentTransparent As Integer)

        Dim alpha As Decimal = percentTransparent / 100 * 255

        ctrl.BackColor = Color.FromArgb(alpha, ctrl.BackColor)

    End Sub

----------


## Icyculyr

Yes, that is cool, thanks...




> If you like it I could show you how to combine it with an extender property so it shows up off of controls (much like Tooltips).


That would be good..


Thanks alot.

----------


## PaulYuk_MS

Sorry it took me so long to pull this together!  

I'm attaching a sample project.  The key parts are:
-TransparencyHelper.vb -- this is a component class (like tooltip) that you can trag onto a form to extend other controls with a Transparency property.  I've implemented IExtenderProvider and set various attributes to show you how that works.  Note, you can change "CanExtend" method to allow this property to show up on more container types.  
-TestForm.vb - shows how to set properties at design-time and in code

Per above, transparency isn't the most reliable technology (e.g. different video cards work better with it than others) but you can use it at your own risk and have fun with it.  

Enjoy.

----------

