Results 1 to 9 of 9

Thread: how do I get my text box's back style to be transparent?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    hello
    how do I get my text box's back style to be transparent?
    NXSupport - Your one-stop source for computer help

  2. #2
    Fanatic Member gwdash's Avatar
    Join Date
    Aug 2000
    Location
    Minnesota
    Posts
    666
    it didn't work for me, but you could try this:
    Code:
    Private Sub Form_Initialize()
    Dim styles As Long
    styles = GetWindowLong(Text1.hwnd, GWL_EXSTYLE)
    Dim newstyle
    newstyle = SetWindowLong(Text1.hwnd, GWL_EXSTYLE, sytles Or WS_EX_TRANSPARENT)
    
    End Sub
    GWDASH
    [b]VB6, Perl, ASP, HTML, JavaScript, VBScript, SQL, C, C++, Linux , Java, PHP, MySQL, XML[b]

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    nope, doesn't work for me either
    NXSupport - Your one-stop source for computer help

  4. #4
    Guest
    Try this:

    Code:
    Option Explicit
    Private Const WS_EX_TRANSPARENT = &H20&
    Private Const GWL_EXSTYLE = (-20)
    
    Private Declare Function SetWindowLong Lib "user32" _
      Alias "SetWindowLongA" (ByVal hwnd As Long, _
      ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
    
    
    Public Function MakeTextboxTransparent(TextCtl As Object) As Boolean
    
    On Error Resume Next
    TextCtl.BackColor = TextCtl.Parent.BackColor
    SetWindowLong TextCtl.hwnd, GWL_EXSTYLE, WS_EX_TRANSPARENT
    MakeTextboxTransparent = Err.LastDllError = 0
    
    End Function
    
    Usage:
    
    MakeTextboxTransparent Text1

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    I did that and it works but it conflictss with the rest of my code
    NXSupport - Your one-stop source for computer help

  6. #6
    Guest
    Post your code where it conflicts (where you make the Textbox transparent).

  7. #7

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    its for the Bat Encoder and an error hit 1 line then I put a ' infront of it and the next line came up to be a problem then the next and the next and the next and the next
    NXSupport - Your one-stop source for computer help

  8. #8
    Guest
    Take away the Option Explicit.

    Another thing: Are you using VB6? Because I try the code in VB6 and it works perfect for me.

  9. #9

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    thanks, I took away the option explicit and it worked... now if I click enter in that text box, the next line gets to be the back ground color.
    NXSupport - Your one-stop source for computer help

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