hello
how do I get my text box's back style to be transparent?
Printable View
hello
how do I get my text box's back style to be transparent?
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
nope, doesn't work for me either
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
I did that and it works but it conflictss with the rest of my code
Post your code where it conflicts (where you make the Textbox transparent).
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
Take away the Option Explicit.
Another thing: Are you using VB6? Because I try the code in VB6 and it works perfect for me.
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.