|
-
Apr 25th, 2001, 09:38 AM
#1
Thread Starter
Member
picture box cannot be made transparent
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
-
Apr 25th, 2001, 02:29 PM
#2
Try:
Code:
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Const GWL_EXSTYLE = (-20)
Private Const WS_EX_TRANSPARENT = &H20&
Private Sub Command1_Click()
Dim lStyle As Long
lStyle = GetWindowLong(Picture1.hwnd, GWL_EXSTYLE)
lStyle = lStyle Or WS_EX_TRANSPARENT
SetWindowLong Picture1.hwnd, GWL_EXSTYLE, lStyle
End Sub
-
Apr 26th, 2001, 01:37 AM
#3
Thread Starter
Member
no change
This code also does not work!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|