Results 1 to 12 of 12

Thread: make background of textbox transparent? Is it possible?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2009
    Location
    Missouri
    Posts
    770

    make background of textbox transparent? Is it possible?

    Is it possible to get the White background of the textbox transparent? And, if so, the blinking line that appears there, how can i change the color of that?
    Rate my post if i helped you!


    Button Configuration Control For VB6 GetAsyncKeyState
    I'm the 7th best high school programmer in the nation!(according to SkillsUSA Nationals)(Used C#.Net)

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: make background of textbox transparent? Is it possible?

    No you cannot make it transparent; however, you can fake transparency by copying what is behind the textbox inside the textbox. This can be very difficult to do especially if scrollbars are used. Here is a vbAccelerator project maybe you want to play with.

    Another option could be... ??
    1. Use a label and a textbox. The label has its backstyle set to transparent and is displayed.
    2. When the user clicks on the label, you show the textbox and set focus to it, then hide the label if needed
    3. When the user leaves the textbox, you update the label and hide the textbox
    Note: labels cannot be tabbed to via the keyboard

    Regarding the color of the caret, never tried it. But CreateCaret may be an API you want to use. Maybe creating a 1-2 pixel wide bitmap about the height of a single line of text and filling it with your color could do the trick. The CreateCaret API can take a bitmap handle for the caret.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2009
    Location
    Missouri
    Posts
    770

    Re: make background of textbox transparent? Is it possible?

    Hmm..... Is there a way that someone using it would think that the label is being typed into(visible), and they are actually typing into the textbox(not visible)?

    Or a way for the user to type into the label?
    Last edited by Gamemaster1494; Jun 17th, 2010 at 06:39 PM.
    Rate my post if i helped you!


    Button Configuration Control For VB6 GetAsyncKeyState
    I'm the 7th best high school programmer in the nation!(according to SkillsUSA Nationals)(Used C#.Net)

  4. #4
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: make background of textbox transparent? Is it possible?

    You could set your textbox, visible, off the form then set focus to it when the label is clicked. But how are you going to display a caret on a label?
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2009
    Location
    Missouri
    Posts
    770

    Re: make background of textbox transparent? Is it possible?

    Can i bitblt on the textbox them? no....... hmm....... okay. i dont want to get into anything complicated at the moment. Just was going to use it for a added effect. Thanks.=)
    Rate my post if i helped you!


    Button Configuration Control For VB6 GetAsyncKeyState
    I'm the 7th best high school programmer in the nation!(according to SkillsUSA Nationals)(Used C#.Net)

  6. #6
    Fanatic Member FireXtol's Avatar
    Join Date
    Apr 2010
    Posts
    874

    Re: make background of textbox transparent? Is it possible?

    You could manually draw the 'textbox'.

    The caret is basically a vbSrcInvert bitblt.

    Or simply have a text box off screen, or whatever. Have a label that when clicked set's focus to the textbox, and have the textbox change event update the label, and have the textbox's getfocus/lostfocus control the rendering of a caret. You can use textwidth to get the approximate location of where to render it, which should be fairly straight-forward as long as it doesn't wrap.

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2009
    Location
    Missouri
    Posts
    770

    Re: make background of textbox transparent? Is it possible?

    Okay. thanks firextol!
    Rate my post if i helped you!


    Button Configuration Control For VB6 GetAsyncKeyState
    I'm the 7th best high school programmer in the nation!(according to SkillsUSA Nationals)(Used C#.Net)

  8. #8
    Member
    Join Date
    Jun 2010
    Posts
    40

    Re: make background of textbox transparent? Is it possible?

    .......Yes. However, I've been told that the old textboxes had the Transparent property, and they can be loaded from the "Microsoft Forms 2.0" component (FM20.dll). But they don't seem to work, at least in my PC.

    You could try.
    Or you could see why they don't work.
    Well, good luck, and if you manage to do it, please tell us how it went.

  9. #9
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: make background of textbox transparent? Is it possible?

    How about making a transparent Textbox on a Form, "coloring the Form" with a full-sized Label with no Caption in it?

    Here I have a transparent Label, a transparent Textbox, and a regular Textbox.
    Attached Images Attached Images  
    Attached Files Attached Files

  10. #10
    Member
    Join Date
    Jun 2010
    Posts
    40

    Re: make background of textbox transparent? Is it possible?

    How about making a transparent Textbox on a Form, "coloring the Form" with a full-sized Label with no Caption in it?
    Oh my God Dilettante!!
    This changes mi VB life!
    So simple (=little code) and SO GREAT!!!

    I'll thank you all my life for that

  11. #11

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2009
    Location
    Missouri
    Posts
    770

    Re: make background of textbox transparent? Is it possible?

    Nah. that is what i was trying not to use was another form. That is a REALLY cool example. can u explain some of the code to me more please?
    Rate my post if i helped you!


    Button Configuration Control For VB6 GetAsyncKeyState
    I'm the 7th best high school programmer in the nation!(according to SkillsUSA Nationals)(Used C#.Net)

  12. #12
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: make background of textbox transparent? Is it possible?

    Well, there isn't much code to explain. LaVolpe is probably laughing, I'm not much for graphics manipulation.

    All it really does is set the Form to transparent using a ColorKey color. The extra Label isn't colored with the "make it transparent" color so that it covers up the transparent Form.

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