jmfmarques
Messages postés
7666
Date d'inscription
samedi 5 novembre 2005
Statut
Membre
Dernière intervention
22 août 2014
27
4 juil. 2007 à 15:40
Moi, je m'en tiens à ce que j'ai dit plus haut et :
Une Form
Sur la Form :
une textbox text1
par dessus la textbox : un Frame Frame1
Dans le Frame Frame1 : un label Label1
code :
Option Explicit
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 SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Const WS_EX_TRANSPARENT = &H20&
Private Const GWL_EXSTYLE = (-20)
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOSIZE = &H1
Private Const SWP_FRAMECHANGED = &H20
Private Declare Function SetBkMode Lib "gdi32" (ByVal hdc As Long, ByVal nBkMode As Long) As Long
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Const TRANSPARENT = 1
Private Declare Function InvalidateRectLong Lib "user32" Alias "InvalidateRect" (ByVal hwnd As Long, ByVal lpRect As Long, ByVal bErase As Long) As Long
Public Sub fantome_ecossais(ByVal fraThis As Control)
Dim lExStyle As Long
lExStyle = GetWindowLong(fraThis.hwnd, GWL_EXSTYLE)
lExStyle = lExStyle Or WS_EX_TRANSPARENT
Call SetWindowLong(fraThis.hwnd, GWL_EXSTYLE, lExStyle)
Call SetBkMode(GetDC(fraThis.hwnd), TRANSPARENT)
Call SetWindowPos(fraThis.hwnd, 0, 0, 0, 0, 0, SWP_NOMOVE + SWP_NOSIZE + SWP_FRAMECHANGED)
Call InvalidateRectLong(fraThis.hwnd, vbNull, True)
End Sub
Private Sub Form_Activate()
Call fantome_ecossais(Frame1)
DoEvents
Frame1.ZOrder
Frame1.BorderStyle = 0
End Sub
Et je veux bien qu'on me coupe la tête s'il n'obtient pas son label par dessus la textbox, dans un cadre transparent ...