Results 1 to 4 of 4

Thread: Controls like textbox with background image?

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2020
    Posts
    63

    Question Controls like textbox with background image?

    Hello, I spent several hours searching the forum for some way to make a textbox transparent so that you could see what is behind it, for example a picturebox with an image.

    And at most I found some projects that I can transparently see the background outside of the process, but not inside it.

    Even if it is being able to draw in the background of a textbox, it would be really useful to simulate transparency.

    For example:
    Name:  Proyecto nuevo.png
Views: 233
Size:  73.1 KB

    I know that this topic is very old, and there are examples with broken links or they simply did not work as expected .

    Thank you so much!
    Last edited by Maatooh; Jun 13th, 2024 at 12:27 PM.

  2. #2
    Fanatic Member BenJones's Avatar
    Join Date
    Mar 2010
    Location
    Wales UK
    Posts
    814

    Re: Controls like textbox with background image?


  3. #3
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,622

    Re: Controls like textbox with background image?

    I like that Ben!!

    I did something SIMILAR (but not the same) with only a few lines of code...it is not exactly what OP asked for, but they might like it. It looks like this after someone types into the textbox:

    Name:  cloudsTextBox.jpg
Views: 202
Size:  25.7 KB

    But while typing in the text box, it changes like this until you hit enter:

    Name:  cloudsTextBox2.jpg
Views: 206
Size:  25.5 KB

    If that's okay, here is the code:

    Code:
    Option Explicit
    
    
    Private Sub Label1_Click()
            Text1.Left = Label1.Left
            Text1.Top = Label1.Top
            Text1.ZOrder (0)
            Text1.Visible = True
            Text1.SetFocus
            Label1.Visible = False
    End Sub
    
    
    Private Sub Text1_KeyPress(KeyAscii As Integer)
            If KeyAscii = 13 Then
                    Label1.Caption = Text1.Text
                    Text1.Visible = False
                    Label1.Visible = True
            End If
    End Sub
    The textbox and label (labelbackGround property set to transparent) are the same size.
    Sam I am (as well as Confused at times).

  4. #4

    Thread Starter
    Member
    Join Date
    Oct 2020
    Posts
    63

    Re: Controls like textbox with background image?

    Thank you very much guys, both are very good solutions, I will reconsider the use of the dynamics between the label and the textbox.

    Ben's solution is the closest to what I was looking for, although when testing the test project, using the debugger generates some unfortunate process crashes.

Tags for this Thread

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