A mettre dans les déclarations de la feuille:
‘——————-Pour la transparence de la feuille
‘—————————————————–
‘—————————————————–
‘Déclaration des constantes
Const SWP_FRAMECHANGED = &H20
Const SWP_DRAWFRAME = SWP_FRAMECHANGED
Const SWP_HIDEWINDOW = &H80
Const SWP_NOACTIVATE = &H10
Const SWP_NOCOPYBITS = &H100
Const SWP_NOMOVE = &H2
Const SWP_NOOWNERZORDER = &H200
Const SWP_NOREDRAW = &H8
Const SWP_NOREPOSITION = SWP_NOOWNERZORDER
Const SWP_NOSIZE = &H1
Const SWP_NOZORDER = &H4
Const SWP_SHOWWINDOW = &H40
‘fonction permettant de positionner la feuille en fond d’écran
Private Declare Function SetWindowPos Lib « user32 » (ByVal hwnd As Long, ByVal param1 As Long, ByVal x As Long, ByVal y As Long, ByVal largeur As Long, ByVal hauteur As Long, ByVal param2 As Long) As Long
‘fonctions permettant la transparence de la form et de la list
Private Declare Function SetLayeredWindowAttributes Lib « user32 » (ByVal hwnd As Long, ByVal couleur As Long, ByVal degre_trans As Byte, ByVal mode As Long) As Boolean
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
‘—————————————————–
‘—————————————————–
‘—————————————————–
A mettre dans le load de la feuille:
‘donne une couleur au fond de la form
‘ au chargement, on rend la couleur noire transparente
Me.BackColor = vbBlack
‘avec getwindowlong passée avec le paramètre -20 on recherche le style étendu de la fenêtre
attrib = GetWindowLong(Me.hwnd, -20)
‘ avec setwindowlong, on rend la fenetre prete pour la fonction setlayeredwindowattribute
SetWindowLong Me.hwnd, -20, attrib Or &H80000
‘la fonction setlayeredwindowattribute, on rend la couleur noire transparente
SetLayeredWindowAttributes Me.hwnd, vbBlack, 0, 1
‘puis on la place en arrière plan
SetWindowPos Me.hwnd, 1, 0, 0, 0, 0, &H1 Or &H2