Does any know how to make a form Opaque or translucent (NOT transparent)?
Printable View
Does any know how to make a form Opaque or translucent (NOT transparent)?
VB 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: [url]http://www.allapi.net/[/url] 'E-Mail: [email][email protected][/email] 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
How on earth do you find somehting like this out. The only way must be to spend hours reading an api manual.
This is excellent and something I have been looking for for ages.
thanks Hack.
Is it possible to make just the form transparent or semi transparent without affecting the controls on it?
:D
I'mnot perfectly sure bout this but shouldn't you be able to pass the hWnd of the controls in the place of Me.hWnd and set it to the value for normal forms? I can't remember if all controls have a hWnd cos i'm not at my PC with VB on so I can't check but I think they do.
So I couldn't be of anymore help.
that code didnt work for me...
i get the error: "cant find dll entry point SetLayeredWindowAttributes in user32"