merci google translate:P
Fonction :
SetLayeredWindowAttributes_(hwnd.i,
crKey.l,
bAlpha.b,
dwFlags.l)
Définit la clé de couleur d'opacité et de transparence d'une fenêtre en couches.
Paramètres
Hwnd [in]
Type: integer
Une poignée sur la fenêtre en couches. Une fenêtre en couches est créée en spécifiant #WS_EX_LAYERED lors de la création de la fenêtre avec la fonction CreateWindowEx_() ou en configurant #WS_EX_LAYERED via SetWindowLong_() une fois la fenêtre créée.
Windows 8: le style #WS_EX_LAYERED est pris en charge pour les fenêtres principales et les fenêtres enfant. Les versions précédentes de Windows supportent #WS_EX_LAYERED uniquement pour les fenêtres de niveau supérieur.
CrKey [in]
Type: Long
spécifie la clé de couleur de transparence à utiliser lors de la composition de la fenêtre en couches. Tous les pixels peints par la fenêtre de cette couleur seront transparents. Pour générer un couleur, utilisez la "RGB(0,0,0)".
BAlpha [in]
Type: BYTE
Valeur alpha utilisée pour décrire l'opacité de la fenêtre en couches. Lorsque bAlpha est 0, la fenêtre est complètement transparente. Lorsque bAlpha est 255, la fenêtre est opaque.
DwFlags [in]
Type: Long
Une action à prendre. Ce paramètre peut être une ou plusieurs des valeurs suivantes:
#LWA_ALPHA($00000002):Utilisez bAlpha pour déterminer l'opacité de la fenêtre en couches.
#LWA_COLORKEY($00000001):Utilisez crKey comme couleur de transparence.
Valeur de retour
Type: BOOL : 0=échoue|1=Ok
Exemple 1
Code : Tout sélectionner
Procedure Window_Set_extended_style(Hwnd.i, IExStyle.l)
SetWindowLong_(Hwnd,#GWL_EXSTYLE,GetWindowLong_(Hwnd,#GWL_EXSTYLE)|IExStyle)
EndProcedure
OpenWindow(0, 0, 0, 500, 300, "SetLayeredWindowAttributes Exemple", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
SetWindowColor(0, RGB(0,0,255))
ButtonGadget(1,200,150,80,20,"Test")
TextGadget(3, 45, 105, 200, 100, "Exemple")
SetGadgetColor(3, #PB_Gadget_BackColor,RGB(0,0,255))
LoadFont(3, "Arial", 28)
SetGadgetFont(3, FontID(3))
ContainerGadget(2, 0, 0, 100, 100)
SetGadgetColor(2, #PB_Gadget_BackColor,RGB(255,0,0))
Window_Set_extended_style(WindowID(0), #WS_EX_LAYERED)
SetLayeredWindowAttributes_(WindowID(0),
RGB(0,0,255),
100,
#LWA_ALPHA|#LWA_COLORKEY)
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
Exemple 2
Code : Tout sélectionner
Procedure Window_Set_extended_style(Hwnd.i, IExStyle.l)
SetWindowLong_(Hwnd,#GWL_EXSTYLE,GetWindowLong_(Hwnd,#GWL_EXSTYLE)|IExStyle)
EndProcedure
OpenWindow(0, 0, 0, 500, 300, "SetLayeredWindowAttributes Exemple", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
SetWindowColor(0, RGB(0,0,255))
ButtonGadget(1,200,150,80,20,"Test")
TextGadget(3, 45, 105, 200, 100, "Exemple")
SetGadgetColor(3, #PB_Gadget_BackColor,RGB(0,0,255))
LoadFont(3, "Arial", 28)
SetGadgetFont(3, FontID(3))
ContainerGadget(2, 0, 0, 100, 100)
SetGadgetColor(2, #PB_Gadget_BackColor,RGB(255,0,0))
Window_Set_extended_style(WindowID(0), #WS_EX_LAYERED)
SetLayeredWindowAttributes_(WindowID(0),
0,
100,
#LWA_ALPHA)
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
Exemple 3
Code : Tout sélectionner
Procedure Window_Set_extended_style(Hwnd.i, IExStyle.l)
SetWindowLong_(Hwnd,#GWL_EXSTYLE,GetWindowLong_(Hwnd,#GWL_EXSTYLE)|IExStyle)
EndProcedure
OpenWindow(0, 0, 0, 500, 300, "SetLayeredWindowAttributes Exemple", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
SetWindowColor(0, RGB(0,0,255))
ButtonGadget(1,200,150,80,20,"Test")
TextGadget(3, 45, 105, 200, 100, "Exemple")
SetGadgetColor(3, #PB_Gadget_BackColor,RGB(0,0,255))
LoadFont(3, "Arial", 28)
SetGadgetFont(3, FontID(3))
ContainerGadget(2, 0, 0, 100, 100)
SetGadgetColor(2, #PB_Gadget_BackColor,RGB(255,0,0))
Window_Set_extended_style(WindowID(0), #WS_EX_LAYERED)
SetLayeredWindowAttributes_(WindowID(0),
RGB(0,0,255),
0,
#LWA_COLORKEY)
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
Exemple 4
Code : Tout sélectionner
Procedure Window_SetTransparency(WinHwnd.i,Op.w)
Protected WinExtendedStyle.l = GetWindowLong_(WinHwnd,#GWL_EXSTYLE)
If Not WinExtendedStyle &#WS_EX_LAYERED
SetWindowLong_(WinHwnd,#GWL_EXSTYLE,WinExtendedStyle|#WS_EX_LAYERED)
EndIf
SetLayeredWindowAttributes_(WinHwnd,
0,
Op,
#LWA_ALPHA)
EndProcedure
Procedure TrackBarEv()
Protected EvWin =EventWindow()
Protected EvGadget=EventGadget()
Protected WinHwnd = WindowID(EvWin)
Protected GetTrackVal.w = GetGadgetState(EvGadget)
Window_SetTransparency(WinHwnd,GetTrackVal)
EndProcedure
OpenWindow(0, 0, 0, 470, 210, "SetLayeredWindowAttributes Exemple", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
TrackBarGadget(1, 100, 110, 230, 25, 0, 255)
BindGadgetEvent(1,@TrackBarEv(),#PB_EventType_LeftClick )
SetGadgetState(1,255)
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow