Results 1 to 9 of 9

Thread: Creating A Transparent Label UserControl

Hybrid View

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2003
    Posts
    1,005

    Creating A Transparent Label UserControl

    Using VB6, can I make a UserControl Form (OCX) transparent?

    I want to make put a label on it too.

    I am making (trying to anyways) a transparent label OCX that I can convert to .NET that will work on picturebox and panels that have pictures in them.

    And if I can make the UserControl transparent... will it work with Win9x. I know transparency work on XP.

    Thanks
    Last edited by epixelman; Mar 19th, 2005 at 05:02 PM.

  2. #2
    PowerPoster Dave Sell's Avatar
    Join Date
    Mar 2004
    Location
    /dev/null
    Posts
    2,961

    Re: Transparent UserControl??

    There is a transparency Property available on any new ActiveX Control.
    Nobody knows what software they want until after you've delivered what they originally asked for.

    Don't solve problems which don't exist.

    "If I had eight hours to cut down a tree, I'd spend six hours sharpening my axe." --- Abraham Lincoln (1809-1865)

    2 idiots don't make a genius.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2003
    Posts
    1,005

    Re: Creating A Transparent Label UserControl

    Okay... I have an OCX going in VB6.

    I can set the caption text... that works.

    Problem..

    But the text does not show when I set the control to transparency. But it shows when the control has an opaque backstyle.

    This is how I have made the OCX...

    I put label on UserControl with the setting of transparency.
    Ran OCX wizard.

    I allowed the UC to handle the backstyle (transparent - opaque.)
    I assume the label will always be transparent cause I set it that way

    Why is my text not showing when the control (UserControl) is set to transparceny in design and run time mode??
    .
    Attached Images Attached Images  

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2003
    Posts
    1,005

    Re: Creating A Transparent Label UserControl

    Just a few feet away from solving this...

    I found out what is wromg with the control, but don't know how to fix or even why it is doing this...

    The Usercontrol (ocx form) stays transparent... that's cool
    But when the Label's (which is on the UC) BackStyle is set to "Transparency" it makes the entire label transparent... text and all.

    But when the label is set to Opaque... you can see backcolor and text.
    I only want to see the text ... no back color.

    So something is wrong with the BackStyle property.
    I tried various configurations with borderstyle, Appearance etc,..
    But it is that Backstyle that is the problem.

    Anyone know why?

    Thanks

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2003
    Posts
    1,005

    Re: Creating A Transparent Label UserControl

    Well... I have dicovered more...

    When you put a label on a UserControl (UC) and set it to transparency, the UC has to redraw the label because it is a lightweight ctrl. Therefore the text gets wiped out and then redraw on the UC.

    But the only way this will work is to use TrueTypeFonts for the label. MS SanSerif will not show up on the control. It's a system text.

    So, I got it to work!!! Yeepie!

    Hold on... not so fast.

    Another problem....
    When the UC redraws the TTFont it appears jaggie with white pixels here and there around the font.

    The only way to make the white pixels disappear is to set the Label forecolor and UC backcolor the same....

    Great... that works!

    But... they only thing that bugs me now is the entire text looks jaggie still... kinda like the text was put on with PaintBrush or something. No anti-Alias text.

    What a bummer!!
    Now what do I do?

    I got the control to work but it dosn't look good!

    AARRRRHHHHHHH


    .

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

    Re: Creating A Transparent Label UserControl

    If you are porting this to .net (using the project convertor?? Good luck with that buddy ) then you may be able to use the Graphics.SmoothingMode = AntiAlias and compositing modes to produce nicer text output.
    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