Results 1 to 9 of 9

Thread: Are you ever going to make objects have a transparency option?

  1. #1

    Thread Starter
    Frenzied Member Icyculyr's Avatar
    Join Date
    Aug 2007
    Location
    Australia
    Posts
    1,934

    Are you ever going to make objects have a transparency option?

    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

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,710

    Re: Are you ever going to make objects have a transparency option?

    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.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: Are you ever going to make objects have a transparency option?

    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

  4. #4
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    Re: Are you ever going to make objects have a transparency option?

    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.
    KrisSiegel.com - My Personal Website with my blog and portfolio
    Don't Forget to Rate Posts!

    Free Icons: FamFamFam, VBCorner, VBAccelerator
    Useful Links: System.Security.SecureString Managed DPAPI Overview Part 1 Managed DPAPI Overview Part 2 MSDN, MSDN2, Comparing the Timer Classes

  5. #5
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,710

    Re: Are you ever going to make objects have a transparency option?

    Labels, Picutreboxes, Panels and GroupBoxes are probably the most needed and feasible controls that would benefit from it.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  6. #6

    Thread Starter
    Frenzied Member Icyculyr's Avatar
    Join Date
    Aug 2007
    Location
    Australia
    Posts
    1,934

    Re: Are you ever going to make objects have a transparency option?

    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

    Cheers

  7. #7
    Special Guest - Microsoft
    Join Date
    Dec 2007
    Posts
    36

    Re: Are you ever going to make objects have a transparency option?

    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
    Paul Yuknewicz
    Lead Program Manager
    Microsoft Visual Basic
    http://msdn.com/vbasic

  8. #8

    Thread Starter
    Frenzied Member Icyculyr's Avatar
    Join Date
    Aug 2007
    Location
    Australia
    Posts
    1,934

    Re: Are you ever going to make objects have a transparency option?

    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.

  9. #9
    Special Guest - Microsoft
    Join Date
    Dec 2007
    Posts
    36

    Re: Are you ever going to make objects have a transparency option?

    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.
    Attached Files Attached Files
    Paul Yuknewicz
    Lead Program Manager
    Microsoft Visual Basic
    http://msdn.com/vbasic

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width