Fond transparent superposé sur une image

lolo - 16 févr. 2000 à 18:12
cs_EBArtSoft Messages postés 4525 Date d'inscription dimanche 29 septembre 2002 Statut Modérateur Dernière intervention 22 avril 2019 - 30 janv. 2006 à 19:13
je voudrais rendre transparent le fond d'un DataCombo que j'ai mis sur une image, pourriez vous me donner la procédure.

Merci

2 réponses

cs_EBArtSoft Messages postés 4525 Date d'inscription dimanche 29 septembre 2002 Statut Modérateur Dernière intervention 22 avril 2019 9
30 janv. 2006 à 19:13
voici une fonction :

Private Const GWL_EXSTYLE As Long = (-20)
Private Const WS_EX_LAYERED As Long = &H80000
Private Const LWA_ALPHA As Long = &H2


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 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


Sub SetTransparency(ByVal whWnd As Long, ByVal wAlpha As Byte)
Dim Style As Long
Dim Ver As Long
If (wAlpha = 255) Then
Style = GetWindowLong(whWnd, GWL_EXSTYLE)
Style = Style And Not WS_EX_LAYERED
SetWindowLong whWnd, GWL_EXSTYLE, Style
Else
Style = GetWindowLong(whWnd, GWL_EXSTYLE)
Style = Style Or WS_EX_LAYERED
SetWindowLong whWnd, GWL_EXSTYLE, Style
SetLayeredWindowAttributes whWnd, 0, wAlpha, LWA_ALPHA
End If
End Sub

@+


E.B.
0
cs_EBArtSoft Messages postés 4525 Date d'inscription dimanche 29 septembre 2002 Statut Modérateur Dernière intervention 22 avril 2019 9
30 janv. 2006 à 19:13
voici une fonction :

Private Const GWL_EXSTYLE As Long = (-20)
Private Const WS_EX_LAYERED As Long = &H80000
Private Const LWA_ALPHA As Long = &H2


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 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


Sub SetTransparency(ByVal whWnd As Long, ByVal wAlpha As Byte)
Dim Style As Long
Dim Ver As Long
If (wAlpha = 255) Then
Style = GetWindowLong(whWnd, GWL_EXSTYLE)
Style = Style And Not WS_EX_LAYERED
SetWindowLong whWnd, GWL_EXSTYLE, Style
Else
Style = GetWindowLong(whWnd, GWL_EXSTYLE)
Style = Style Or WS_EX_LAYERED
SetWindowLong whWnd, GWL_EXSTYLE, Style
SetLayeredWindowAttributes whWnd, 0, wAlpha, LWA_ALPHA
End If
End Sub

@+


E.B.
0
Rejoignez-nous