-
Hi!!!
Can I mke a Form in VB 5 quite transparent?? I mean if behind of the form is the desktop can I see that with alphablending? And I don't want to take a picture of the thing behind of the form and put it as image of the form
for example can I see a clock behind the form running??
Thanks
Wolverine
-
Only if you have Windows 2000 (which supports translucant windows), otherwise you'll have to fake it, which about 99% of the time looks horrible and 102% which won't update what's behind it. :D
Btw, here's the code for Win2K, I haven't tested it yet, but it's copied straight from the API Guide, so it should work:
Code:
Const LWA_COLORKEY = &H1
Const LWA_ALPHA = &H2
Const GWL_EXSTYLE = (-20)
Const WS_EX_LAYERED = &H80000
Private Declare Function GetWindowLong Lib "user32" _
Alias "GetWindowLongA" (ByVal hWnd As Long, _
ByVal nIndex As Long) As Long
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 SetLayeredWindowAttributes Lib "user32" _
(ByVal hWnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, _
ByVal dwFlags As Long) As Long
Private Sub Form_Load()
'KPD-Team 2000
'URL: http://www.allapi.net/
'E-Mail: [email protected]
Dim Ret As Long
'Set the window style To 'Layered'
Ret = GetWindowLong(Me.hWnd, GWL_EXSTYLE)
Ret = Ret Or WS_EX_LAYERED
SetWindowLong Me.hWnd, GWL_EXSTYLE, Ret
'Set the opacity of the layered window To 128
SetLayeredWindowAttributes Me.hWnd, 0, 128, LWA_ALPHA
End Sub
-
Is there any way to use this code on mdichildren or on controls in your form. I want to have a form with an image on it and all the controls on top to be translucent so you can see the image.
-
Neither MDI children nor individual controls worked with my tests...
-
Is there any other way I can do this then?
-
Draw them yourself, but that's a lot of work...