Attribute VB_Name = "ModTransparent" Option Explicit Private Const WS_EX_LAYERED = &H80000 Private Const LWA_ALPHA = &H2 Private Const GWL_EXSTYLE = (-20) Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hWnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Boolean Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long Public Sub RendreTransparent(etat As Boolean, Fenetre As Form, Optional ByVal Alpha As Byte = 255) If etat Then SetWindowLong Fenetre.hWnd, GWL_EXSTYLE, GetWindowLong(Fenetre.hWnd, GWL_EXSTYLE) Or WS_EX_LAYERED SetLayeredWindowAttributes Fenêtre.hWnd, 0, Alpha, LWA_ALPHA Else SetWindowLong Fenetre.hWnd, GWL_EXSTYLE, GetWindowLong(Fenetre.hWnd, GWL_EXSTYLE) - WS_EX_LAYERED End If End Sub