Ciao a tutti.
Sto cercando di rendere un form semi-trasparente usando questo codice:
codice:
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 Declare Function SetLayeredWindowAttributes Lib "user32" _
(ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Long, ByVal dwFlags _
As Long) As Long
Private Const LWA_ALPHA = &H2&
Private Const GWL_EXSTYLE = (-20)
Private Const WS_EX_LAYERED = &H80000
Private Sub Phantom(hwnd As Long, bytOpacity)
'Form Semitrasparente
Dim buf As String * 1024
Call SetWindowLong(hwnd, GWL_EXSTYLE, GetWindowLong _
(hwnd, GWL_EXSTYLE) Or WS_EX_LAYERED)
Call SetLayeredWindowAttributes(hwnd, 0, bytOpacity, LWA_ALPHA)
End Sub
Private Sub Form_Load()
Phantom Me.hwnd, 220
End Sub
Questo codice però, non essendo farina del mio sacco, non mi da a pieno i risultati voluti.
Vorrei poter rendere solo l'area del form semi-trasparente, lasciando immutata la barra del titolo e tutti gli altri controlli presenti sul form, che in seguito alla chiamata alla funzione Phantom (...) risultano semi-trasparenti anch'essi.
Come si risolve il problema? Confido in una vostra risposta e ringrazio anticipatamente.
Ciao