fbokker
Apr 25th, 2001, 09:38 AM
I just tried to make a transparent picturebox using SetWindowLongA. It doesn't get transparent! do i make something wrong or is it a bug?
And if it is a bug, is there any way to make my picturebox transparent then?
try this code: (add a picturebox, a command-button and something that is hidden beneath the picturebox)
Const GWL_EXSTYLE = (-20)
Const WS_EX_TRANSPARENT = &H20&
Private Declare Function SetWindowLong Lib "user32" Alias _
"SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Private Sub Command1_Click()
Dim result As Long
Picture1.ZOrder
result = SetWindowLong(Picture1.hwnd, GWL_EXSTYLE, _
WS_EX_TRANSPARENT)
End Sub
in MSDN this acutally is reported to be a bug in VB 5.0, but they don't tell about VB6. (and shouldn't they have fixed it in the meantime, if they already knew at the times of VB5 of this bug?) msdn:Q185626
And if it is a bug, is there any way to make my picturebox transparent then?
try this code: (add a picturebox, a command-button and something that is hidden beneath the picturebox)
Const GWL_EXSTYLE = (-20)
Const WS_EX_TRANSPARENT = &H20&
Private Declare Function SetWindowLong Lib "user32" Alias _
"SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Private Sub Command1_Click()
Dim result As Long
Picture1.ZOrder
result = SetWindowLong(Picture1.hwnd, GWL_EXSTYLE, _
WS_EX_TRANSPARENT)
End Sub
in MSDN this acutally is reported to be a bug in VB 5.0, but they don't tell about VB6. (and shouldn't they have fixed it in the meantime, if they already knew at the times of VB5 of this bug?) msdn:Q185626