est il possible de rendre une fenetre partiellement transparente. J'ai deja
trouvé comment rendre un picture box transparent mais pas la fenetre elle
meme.
Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
ng
Salut,
Sous XP/2k seulemement :
Option Explicit
Private Const LWA_ALPHA = &H2 Private Const GWL_EXSTYLE = (-20) Private Const WS_EX_LAYERED = &H80000 Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex 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 SetLayeredWindowAttributes Lib "user32" (ByVal hWnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Public Sub FixTransparence(lTrans As Long, lhWnd As Long) Dim lRet As Long lRet = GetWindowLong(lhWnd, GWL_EXSTYLE) lRet = lRet Or WS_EX_LAYERED Call SetWindowLong(lhWnd, GWL_EXSTYLE, lRet) Call SetLayeredWindowAttributes(lhWnd, 0, lTrans, LWA_ALPHA) End Sub
Private Sub Form_Load() Call FixTransparence(200, Me.hWnd) End Sub
-- Nicolas G. FAQ VB : http://faq.vb.free.fr API Guide : http://www.allapi.net Google Groups : http://groups.google.fr/ MZ-Tools : http://www.mztools.com/
Dom wrote:
Bonjour,
est il possible de rendre une fenetre partiellement transparente. J'ai deja trouvé comment rendre un picture box transparent mais pas la fenetre elle meme.
Merci d'avance pour le truc
Dom
Salut,
Sous XP/2k seulemement :
Option Explicit
Private Const LWA_ALPHA = &H2
Private Const GWL_EXSTYLE = (-20)
Private Const WS_EX_LAYERED = &H80000
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA"
(ByVal hWnd As Long, ByVal nIndex 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 SetLayeredWindowAttributes Lib "user32" (ByVal hWnd
As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long)
As Long
Public Sub FixTransparence(lTrans As Long, lhWnd As Long)
Dim lRet As Long
lRet = GetWindowLong(lhWnd, GWL_EXSTYLE)
lRet = lRet Or WS_EX_LAYERED
Call SetWindowLong(lhWnd, GWL_EXSTYLE, lRet)
Call SetLayeredWindowAttributes(lhWnd, 0, lTrans, LWA_ALPHA)
End Sub
Private Sub Form_Load()
Call FixTransparence(200, Me.hWnd)
End Sub
--
Nicolas G.
FAQ VB : http://faq.vb.free.fr
API Guide : http://www.allapi.net
Google Groups : http://groups.google.fr/
MZ-Tools : http://www.mztools.com/
Dom wrote:
Bonjour,
est il possible de rendre une fenetre partiellement transparente.
J'ai deja trouvé comment rendre un picture box transparent mais pas
la fenetre elle meme.
Private Const LWA_ALPHA = &H2 Private Const GWL_EXSTYLE = (-20) Private Const WS_EX_LAYERED = &H80000 Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex 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 SetLayeredWindowAttributes Lib "user32" (ByVal hWnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Public Sub FixTransparence(lTrans As Long, lhWnd As Long) Dim lRet As Long lRet = GetWindowLong(lhWnd, GWL_EXSTYLE) lRet = lRet Or WS_EX_LAYERED Call SetWindowLong(lhWnd, GWL_EXSTYLE, lRet) Call SetLayeredWindowAttributes(lhWnd, 0, lTrans, LWA_ALPHA) End Sub
Private Sub Form_Load() Call FixTransparence(200, Me.hWnd) End Sub
-- Nicolas G. FAQ VB : http://faq.vb.free.fr API Guide : http://www.allapi.net Google Groups : http://groups.google.fr/ MZ-Tools : http://www.mztools.com/
Dom wrote:
Bonjour,
est il possible de rendre une fenetre partiellement transparente. J'ai deja trouvé comment rendre un picture box transparent mais pas la fenetre elle meme.
Merci d'avance pour le truc
Dom
Guy DETIENNE
Salut ;O)
En utilisant l'API SetLayeredWindowAttributes
Ici : http://www.vbfrance.com/code.aspx?id$621
Ou là : http://vbnet.mvps.org/index.html?code/forms/setlayeredwindowattributes.htm
Guy
"Dom" a écrit dans le message de news:420e8313$0$12846$
Bonjour,
est il possible de rendre une fenetre partiellement transparente. J'ai
deja
trouvé comment rendre un picture box transparent mais pas la fenetre elle meme.
Merci d'avance pour le truc
Dom
Salut ;O)
En utilisant l'API SetLayeredWindowAttributes
Ici :
http://www.vbfrance.com/code.aspx?id$621
Ou là :
http://vbnet.mvps.org/index.html?code/forms/setlayeredwindowattributes.htm
Guy
"Dom" <adresse.bidon@nospam.fr> a écrit dans le message de
news:420e8313$0$12846$626a14ce@news.free.fr...
Bonjour,
est il possible de rendre une fenetre partiellement transparente. J'ai
deja
trouvé comment rendre un picture box transparent mais pas la fenetre elle
meme.
Ou là : http://vbnet.mvps.org/index.html?code/forms/setlayeredwindowattributes.htm
Guy
"Dom" a écrit dans le message de news:420e8313$0$12846$
Bonjour,
est il possible de rendre une fenetre partiellement transparente. J'ai
deja
trouvé comment rendre un picture box transparent mais pas la fenetre elle meme.
Merci d'avance pour le truc
Dom
François Picalausa
Hello,
Il est possible d'appliquer une region a une fenêtre, qui définira les zones où la fenêtre est visible. Ceci se fait par l'API SetWindowRgn, et la création de la region correspondante.
Il est aussi possible d'employer des "layered windows" (introduites par windows 2k), à l'aide de l'API SetLayeredWindowAttributes. Il faut aussi employer SetWindowLong, pour redéfinir le style.
Les deux articles suivants montrent celà: http://faq.vb.free.fr/index.php?question5 http://support.microsoft.com/default.aspx?scid=kb;en-us;249341
-- François Picalausa
"Dom" a écrit dans le message de news: 420e8313$0$12846$
Bonjour,
est il possible de rendre une fenetre partiellement transparente. J'ai deja trouvé comment rendre un picture box transparent mais pas la fenetre elle meme.
Merci d'avance pour le truc
Dom
Hello,
Il est possible d'appliquer une region a une fenêtre, qui définira les zones
où la fenêtre est visible.
Ceci se fait par l'API SetWindowRgn, et la création de la region
correspondante.
Il est aussi possible d'employer des "layered windows" (introduites par
windows 2k), à l'aide de l'API SetLayeredWindowAttributes. Il faut aussi
employer SetWindowLong, pour redéfinir le style.
Les deux articles suivants montrent celà:
http://faq.vb.free.fr/index.php?question5
http://support.microsoft.com/default.aspx?scid=kb;en-us;249341
--
François Picalausa
"Dom" <adresse.bidon@nospam.fr> a écrit dans le message de news:
420e8313$0$12846$626a14ce@news.free.fr
Bonjour,
est il possible de rendre une fenetre partiellement transparente.
J'ai deja trouvé comment rendre un picture box transparent mais pas
la fenetre elle meme.
Il est possible d'appliquer une region a une fenêtre, qui définira les zones où la fenêtre est visible. Ceci se fait par l'API SetWindowRgn, et la création de la region correspondante.
Il est aussi possible d'employer des "layered windows" (introduites par windows 2k), à l'aide de l'API SetLayeredWindowAttributes. Il faut aussi employer SetWindowLong, pour redéfinir le style.
Les deux articles suivants montrent celà: http://faq.vb.free.fr/index.php?question5 http://support.microsoft.com/default.aspx?scid=kb;en-us;249341
-- François Picalausa
"Dom" a écrit dans le message de news: 420e8313$0$12846$
Bonjour,
est il possible de rendre une fenetre partiellement transparente. J'ai deja trouvé comment rendre un picture box transparent mais pas la fenetre elle meme.