On m'a posé la question tout à l'heure par email, je transmet donc ma
réponse sur le groupe, ca peut en interessé d'autres.
'//Mettre un CommandButton nommé Command1 sur la feuille et coller ce code :
'//Fait à partir d'un exemple de l'API-Guide
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 Command1_Click()
Call FixTransparence(128, 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/
http://apisvb.europe.webmatrixhosting.net/
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
François Picalausa
Hello,
Voir aussi l'article de la KB: http://support.microsoft.com/default.aspx?kbid$9341
-- François Picalausa (MVP VB) http://faq.vb.free.fr --- http://msdn.microsoft.com http://apisvb.europe.webmatrixhosting.net
"ng" a écrit dans le message de news:ecK$
Bonjour à tous,
On m'a posé la question tout à l'heure par email, je transmet donc ma réponse sur le groupe, ca peut en interessé d'autres.
'//Mettre un CommandButton nommé Command1 sur la feuille et coller ce code : '//Fait à partir d'un exemple de l'API-Guide 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 Command1_Click() Call FixTransparence(128, Me.hWnd) End Sub
Hello,
Voir aussi l'article de la KB:
http://support.microsoft.com/default.aspx?kbid$9341
--
François Picalausa (MVP VB)
http://faq.vb.free.fr --- http://msdn.microsoft.com
http://apisvb.europe.webmatrixhosting.net
"ng" <ng@babeuk.net> a écrit dans le message de
news:ecK$0oUJEHA.1392@TK2MSFTNGP09.phx.gbl
Bonjour à tous,
On m'a posé la question tout à l'heure par email, je transmet donc ma
réponse sur le groupe, ca peut en interessé d'autres.
'//Mettre un CommandButton nommé Command1 sur la feuille et coller ce
code : '//Fait à partir d'un exemple de l'API-Guide
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 Command1_Click()
Call FixTransparence(128, Me.hWnd)
End Sub
Voir aussi l'article de la KB: http://support.microsoft.com/default.aspx?kbid$9341
-- François Picalausa (MVP VB) http://faq.vb.free.fr --- http://msdn.microsoft.com http://apisvb.europe.webmatrixhosting.net
"ng" a écrit dans le message de news:ecK$
Bonjour à tous,
On m'a posé la question tout à l'heure par email, je transmet donc ma réponse sur le groupe, ca peut en interessé d'autres.
'//Mettre un CommandButton nommé Command1 sur la feuille et coller ce code : '//Fait à partir d'un exemple de l'API-Guide 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 Command1_Click() Call FixTransparence(128, Me.hWnd) End Sub
Pascal B.
Bonjour,
Le code met toute la Form transparente (ou semi-transparente) ainsi que les contrôles! Quelle est l'interrêt ???
Ce qui serait intéressant, ce serait d'avoir des zones non-transprentes...
Pascal
"François Picalausa" a écrit dans le message de news: | Hello, | | Voir aussi l'article de la KB: | http://support.microsoft.com/default.aspx?kbid$9341 | | -- | François Picalausa (MVP VB) | http://faq.vb.free.fr --- http://msdn.microsoft.com | http://apisvb.europe.webmatrixhosting.net | | "ng" a écrit dans le message de | news:ecK$ | > Bonjour à tous, | > | > On m'a posé la question tout à l'heure par email, je transmet donc ma | > réponse sur le groupe, ca peut en interessé d'autres. | > | > | > '//Mettre un CommandButton nommé Command1 sur la feuille et coller ce | > code : '//Fait à partir d'un exemple de l'API-Guide | > 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 Command1_Click() | > Call FixTransparence(128, Me.hWnd) | > End Sub | |
Bonjour,
Le code met toute la Form transparente (ou semi-transparente) ainsi que les contrôles!
Quelle est l'interrêt ???
Ce qui serait intéressant, ce serait d'avoir des zones non-transprentes...
Pascal
"François Picalausa" <fpicalausa@chez.com> a écrit dans le message de news:O3nP6tUJEHA.3264@tk2msftngp13.phx.gbl...
| Hello,
|
| Voir aussi l'article de la KB:
| http://support.microsoft.com/default.aspx?kbid$9341
|
| --
| François Picalausa (MVP VB)
| http://faq.vb.free.fr --- http://msdn.microsoft.com
| http://apisvb.europe.webmatrixhosting.net
|
| "ng" <ng@babeuk.net> a écrit dans le message de
| news:ecK$0oUJEHA.1392@TK2MSFTNGP09.phx.gbl
| > Bonjour à tous,
| >
| > On m'a posé la question tout à l'heure par email, je transmet donc ma
| > réponse sur le groupe, ca peut en interessé d'autres.
| >
| >
| > '//Mettre un CommandButton nommé Command1 sur la feuille et coller ce
| > code : '//Fait à partir d'un exemple de l'API-Guide
| > 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 Command1_Click()
| > Call FixTransparence(128, Me.hWnd)
| > End Sub
|
|
Le code met toute la Form transparente (ou semi-transparente) ainsi que les contrôles! Quelle est l'interrêt ???
Ce qui serait intéressant, ce serait d'avoir des zones non-transprentes...
Pascal
"François Picalausa" a écrit dans le message de news: | Hello, | | Voir aussi l'article de la KB: | http://support.microsoft.com/default.aspx?kbid$9341 | | -- | François Picalausa (MVP VB) | http://faq.vb.free.fr --- http://msdn.microsoft.com | http://apisvb.europe.webmatrixhosting.net | | "ng" a écrit dans le message de | news:ecK$ | > Bonjour à tous, | > | > On m'a posé la question tout à l'heure par email, je transmet donc ma | > réponse sur le groupe, ca peut en interessé d'autres. | > | > | > '//Mettre un CommandButton nommé Command1 sur la feuille et coller ce | > code : '//Fait à partir d'un exemple de l'API-Guide | > 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 Command1_Click() | > Call FixTransparence(128, Me.hWnd) | > End Sub | |
ng
Salut,
Je sais un pas, mais ca fait un effet interessant pour une form-menu par exemple (un peu transparente), j'ai déjà vu ca et l'effet est assez surprenant.
On pourrait également s'en servir pour faire apparaitre/disparaitre la form progressivement, place ce code dans une form :
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
Dim bShow As Boolean
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_Activate() If Not bShow Then bShow = True Dim i As Long For i = 1 To 255 Call FixTransparence(i, Me.hWnd) DoEvents Next End If End Sub
Private Sub Form_Load()
Call FixTransparence(0, Me.hWnd)
End Sub
Private Sub Form_Unload(Cancel As Integer) Dim i As Long For i = 255 To 0 Step -1 Call FixTransparence(i, Me.hWnd) DoEvents Next 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/ http://apisvb.europe.webmatrixhosting.net/
Pascal B. <pascbr{_AROBASE_}hotmail{_POINT_}com> a écrit :
Bonjour,
Le code met toute la Form transparente (ou semi-transparente) ainsi que les contrôles! Quelle est l'interrêt ???
Ce qui serait intéressant, ce serait d'avoir des zones non-transprentes...
Pascal
"François Picalausa" a écrit dans le message de news:
Hello,
Voir aussi l'article de la KB: http://support.microsoft.com/default.aspx?kbid$9341
-- François Picalausa (MVP VB) http://faq.vb.free.fr --- http://msdn.microsoft.com http://apisvb.europe.webmatrixhosting.net
"ng" a écrit dans le message de news:ecK$
Bonjour à tous,
On m'a posé la question tout à l'heure par email, je transmet donc ma réponse sur le groupe, ca peut en interessé d'autres.
'//Mettre un CommandButton nommé Command1 sur la feuille et coller ce code : '//Fait à partir d'un exemple de l'API-Guide 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 Command1_Click() Call FixTransparence(128, Me.hWnd) End Sub
Salut,
Je sais un pas, mais ca fait un effet interessant pour une form-menu par
exemple (un peu transparente), j'ai déjà vu ca et l'effet est assez
surprenant.
On pourrait également s'en servir pour faire apparaitre/disparaitre la form
progressivement, place ce code dans une form :
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
Dim bShow As Boolean
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_Activate()
If Not bShow Then
bShow = True
Dim i As Long
For i = 1 To 255
Call FixTransparence(i, Me.hWnd)
DoEvents
Next
End If
End Sub
Private Sub Form_Load()
Call FixTransparence(0, Me.hWnd)
End Sub
Private Sub Form_Unload(Cancel As Integer)
Dim i As Long
For i = 255 To 0 Step -1
Call FixTransparence(i, Me.hWnd)
DoEvents
Next
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/
http://apisvb.europe.webmatrixhosting.net/
Pascal B. <pascbr{_AROBASE_}hotmail{_POINT_}com> a écrit :
Bonjour,
Le code met toute la Form transparente (ou semi-transparente) ainsi
que les contrôles!
Quelle est l'interrêt ???
Ce qui serait intéressant, ce serait d'avoir des zones
non-transprentes...
Pascal
"François Picalausa" <fpicalausa@chez.com> a écrit dans le message de
news:O3nP6tUJEHA.3264@tk2msftngp13.phx.gbl...
Hello,
Voir aussi l'article de la KB:
http://support.microsoft.com/default.aspx?kbid$9341
--
François Picalausa (MVP VB)
http://faq.vb.free.fr --- http://msdn.microsoft.com
http://apisvb.europe.webmatrixhosting.net
"ng" <ng@babeuk.net> a écrit dans le message de
news:ecK$0oUJEHA.1392@TK2MSFTNGP09.phx.gbl
Bonjour à tous,
On m'a posé la question tout à l'heure par email, je transmet donc
ma réponse sur le groupe, ca peut en interessé d'autres.
'//Mettre un CommandButton nommé Command1 sur la feuille et coller
ce code : '//Fait à partir d'un exemple de l'API-Guide
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 Command1_Click()
Call FixTransparence(128, Me.hWnd)
End Sub
Je sais un pas, mais ca fait un effet interessant pour une form-menu par exemple (un peu transparente), j'ai déjà vu ca et l'effet est assez surprenant.
On pourrait également s'en servir pour faire apparaitre/disparaitre la form progressivement, place ce code dans une form :
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
Dim bShow As Boolean
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_Activate() If Not bShow Then bShow = True Dim i As Long For i = 1 To 255 Call FixTransparence(i, Me.hWnd) DoEvents Next End If End Sub
Private Sub Form_Load()
Call FixTransparence(0, Me.hWnd)
End Sub
Private Sub Form_Unload(Cancel As Integer) Dim i As Long For i = 255 To 0 Step -1 Call FixTransparence(i, Me.hWnd) DoEvents Next 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/ http://apisvb.europe.webmatrixhosting.net/
Pascal B. <pascbr{_AROBASE_}hotmail{_POINT_}com> a écrit :
Bonjour,
Le code met toute la Form transparente (ou semi-transparente) ainsi que les contrôles! Quelle est l'interrêt ???
Ce qui serait intéressant, ce serait d'avoir des zones non-transprentes...
Pascal
"François Picalausa" a écrit dans le message de news:
Hello,
Voir aussi l'article de la KB: http://support.microsoft.com/default.aspx?kbid$9341
-- François Picalausa (MVP VB) http://faq.vb.free.fr --- http://msdn.microsoft.com http://apisvb.europe.webmatrixhosting.net
"ng" a écrit dans le message de news:ecK$
Bonjour à tous,
On m'a posé la question tout à l'heure par email, je transmet donc ma réponse sur le groupe, ca peut en interessé d'autres.
'//Mettre un CommandButton nommé Command1 sur la feuille et coller ce code : '//Fait à partir d'un exemple de l'API-Guide 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 Command1_Click() Call FixTransparence(128, Me.hWnd) End Sub
François Picalausa
Hello!
non pas tout transparent.. seulement partiellement! Soit partiellement par le niveau de transparence, comme dans le post de ng soit partiellement par zones de couleurs!
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
Me.BackColor = vbRed 'il faut une "vraie" couleur RGB et 'pas une couleur système SetLayeredWindowAttributes Me.hwnd, Me.BackColor, 0, LWA_COLORKEY
End Sub
-- François Picalausa (MVP VB) http://faq.vb.free.fr --- http://msdn.microsoft.com http://apisvb.europe.webmatrixhosting.net
"Pascal B." <pascbr{_AROBASE_}hotmail{_POINT_}com> a écrit dans le message de news:%
Bonjour,
Le code met toute la Form transparente (ou semi-transparente) ainsi que les contrôles! Quelle est l'interrêt ???
Ce qui serait intéressant, ce serait d'avoir des zones non-transprentes...
Pascal
"François Picalausa" a écrit dans le message de news:
Hello,
Voir aussi l'article de la KB: http://support.microsoft.com/default.aspx?kbid$9341
-- François Picalausa (MVP VB) http://faq.vb.free.fr --- http://msdn.microsoft.com http://apisvb.europe.webmatrixhosting.net
"ng" a écrit dans le message de news:ecK$
Bonjour à tous,
On m'a posé la question tout à l'heure par email, je transmet donc ma réponse sur le groupe, ca peut en interessé d'autres.
'//Mettre un CommandButton nommé Command1 sur la feuille et coller ce code : '//Fait à partir d'un exemple de l'API-Guide 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 Command1_Click() Call FixTransparence(128, Me.hWnd) End Sub
Hello!
non pas tout transparent.. seulement partiellement!
Soit partiellement par le niveau de transparence, comme dans le post de ng
soit partiellement par zones de couleurs!
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
Me.BackColor = vbRed 'il faut une "vraie" couleur RGB et
'pas une couleur système
SetLayeredWindowAttributes Me.hwnd, Me.BackColor, 0, LWA_COLORKEY
End Sub
--
François Picalausa (MVP VB)
http://faq.vb.free.fr --- http://msdn.microsoft.com
http://apisvb.europe.webmatrixhosting.net
"Pascal B." <pascbr{_AROBASE_}hotmail{_POINT_}com> a écrit dans le
message de news:%23SM4hWeJEHA.2844@TK2MSFTNGP10.phx.gbl
Bonjour,
Le code met toute la Form transparente (ou semi-transparente) ainsi
que les contrôles!
Quelle est l'interrêt ???
Ce qui serait intéressant, ce serait d'avoir des zones
non-transprentes...
Pascal
"François Picalausa" <fpicalausa@chez.com> a écrit dans le message de
news:O3nP6tUJEHA.3264@tk2msftngp13.phx.gbl...
Hello,
Voir aussi l'article de la KB:
http://support.microsoft.com/default.aspx?kbid$9341
--
François Picalausa (MVP VB)
http://faq.vb.free.fr --- http://msdn.microsoft.com
http://apisvb.europe.webmatrixhosting.net
"ng" <ng@babeuk.net> a écrit dans le message de
news:ecK$0oUJEHA.1392@TK2MSFTNGP09.phx.gbl
Bonjour à tous,
On m'a posé la question tout à l'heure par email, je transmet donc
ma réponse sur le groupe, ca peut en interessé d'autres.
'//Mettre un CommandButton nommé Command1 sur la feuille et coller
ce code : '//Fait à partir d'un exemple de l'API-Guide
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 Command1_Click()
Call FixTransparence(128, Me.hWnd)
End Sub
non pas tout transparent.. seulement partiellement! Soit partiellement par le niveau de transparence, comme dans le post de ng soit partiellement par zones de couleurs!
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
Me.BackColor = vbRed 'il faut une "vraie" couleur RGB et 'pas une couleur système SetLayeredWindowAttributes Me.hwnd, Me.BackColor, 0, LWA_COLORKEY
End Sub
-- François Picalausa (MVP VB) http://faq.vb.free.fr --- http://msdn.microsoft.com http://apisvb.europe.webmatrixhosting.net
"Pascal B." <pascbr{_AROBASE_}hotmail{_POINT_}com> a écrit dans le message de news:%
Bonjour,
Le code met toute la Form transparente (ou semi-transparente) ainsi que les contrôles! Quelle est l'interrêt ???
Ce qui serait intéressant, ce serait d'avoir des zones non-transprentes...
Pascal
"François Picalausa" a écrit dans le message de news:
Hello,
Voir aussi l'article de la KB: http://support.microsoft.com/default.aspx?kbid$9341
-- François Picalausa (MVP VB) http://faq.vb.free.fr --- http://msdn.microsoft.com http://apisvb.europe.webmatrixhosting.net
"ng" a écrit dans le message de news:ecK$
Bonjour à tous,
On m'a posé la question tout à l'heure par email, je transmet donc ma réponse sur le groupe, ca peut en interessé d'autres.
'//Mettre un CommandButton nommé Command1 sur la feuille et coller ce code : '//Fait à partir d'un exemple de l'API-Guide 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 Command1_Click() Call FixTransparence(128, Me.hWnd) End Sub