Results 1 to 11 of 11

Thread: Transparent Labels!!!

  1. #1

    Thread Starter
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Transparent Labels!!!

    Don't expect miracles here, this code is onle 10% done, but it does demonstrate how to make a supposedly solid control "transparent".

    The main code you want to look at is in the TransLab.vb file. Pay attention to the TextChanged and OnPaint methods. There has been overwhelming pressure to show this to you all so I have not had time to comment or even finish this.

    Most of you are bright enough to figure out how it works

    Run the test program (included) and hit the partially obscured button.

    Rate me!!!!

    Let me know what you think.

    ######
    Issues: Nothing much really, when the test app fires up, click the button as mentioned above and then label should spring to life, you may have to force a repaint by moving the form offscreen and bring it back.
    Attached Files Attached Files
    I don't live here any more.

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

    Re: Transparent Labels!!!

    Nice and simple example wossy

    I had a question, why do you dissallow the user to see the text changes in design time?
    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
    Fanatic Member
    Join Date
    Oct 2003
    Posts
    1,005

    Re: Transparent Labels!!!

    Woosname....

    Thats a good start.
    Can't wait until it is finished

    Thanks

  4. #4

    Thread Starter
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: Transparent Labels!!!

    Quote Originally Posted by RobDog888
    Nice and simple example wossy

    I had a question, why do you dissallow the user to see the text changes in design time?
    I didn't, not deliberately anyway, its that I didn't get round to making it public. I was only aiming to get the effect, I wasn't trying to make a full control

    Epix: You'll have to wait I'm afraid. I have no plans to finish this at the moment.
    I don't live here any more.

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

    Re: Transparent Labels!!!

    Wossname, here is the updated/modified control project.
    1. Added design time transparency support.

    2. Added support for the Text and ForeColor properties.

    3. Added updates to the Text and ForeColor properties in design time.

    4. Added ReadOnly attributes to the BackColor and BackgroundImage properties since they are not part of the controls needed properties.

    5. Added descriptions to the properties in the IDE properties help text window.

    6. Added defaults to the Text and ForeColor properties.

    7. Added a backbuffer to optimize and reduce flickering.


    Let me know what you guys think.



    Attached Images Attached Images  
    Attached Files Attached Files
    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
    Junior Member
    Join Date
    Mar 2005
    Posts
    26

    Re: Transparent Labels!!!

    this is pretty cool!
    good job, guys.

  7. #7
    New Member
    Join Date
    Mar 2005
    Posts
    1

    Re: Transparent Labels!!!

    Nice job.

    Is there a way to give the text the same clarity an resolution as standard labels, just with a transparent background?

    Also why does the text always show up smaller than the selected font size?

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

    Re: Transparent Labels!!!

    Welcome to the Forums eddie2000au.

    The jaggie text can not be smoothed because of the method used to draw and cut the text. Its using the
    DrawText method of the graphicspath object which does not support AntiAliasing.

    The font size issue is because we didnt add support for fontsize, only fontcolor.

    Glad you like it though. Maybe at some point we can determine a different method for transparency that will
    allow us to smooth the text.
    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

  9. #9

    Thread Starter
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: Transparent Labels!!!

    Quote Originally Posted by eddie2000au
    Also why does the text always show up smaller than the selected font size?
    I also found this in my own version of the control (derived directly from Class Control rather than usercontrol). Frankly I have no idea. You can set the size of the font in the properties window like with any control, but it always seems to come out about 20% smaller at runtime than it does in designmode. Weird. Must be something to do with the way GraphicsPath.AddString works.

    As Rob said, antialiasing in this articular situation is impossible because there is no available background to composite with. This is a problem that would take quite a lot of time and API to fix. It is possible though, and it would probably cause a lot of overhead.
    I don't live here any more.

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

    Re: Transparent Labels!!!

    Hey wossname, any new ideas on other methods for drawing the text only.
    Perhaps some way to utilize a lables transparency to actually copy the colors behind it except for the text?
    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

  11. #11

    Thread Starter
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: Transparent Labels!!!

    Quote Originally Posted by RobDog888
    Hey wossname, any new ideas on other methods for drawing the text only.
    Perhaps some way to utilize a lables transparency to actually copy the colors behind it except for the text?
    Nope. I haven't given it any further thought. Doubt I'd ever need such a control anyway.
    I don't live here any more.

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