' * Give an Office 2000 look to your controls
' *
' **********************************************************************
'NB : BorderStyle = 0 to the controls to see
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 GWL_EXSTYLE = (-20)
Private Const WS_EX_CLIENTEDGE = &H200
Private Const WS_EX_STATICEDGE = &H20000
Private Const SWP_FRAMECHANGED = &H20 ' Frame Changed
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOOWNERZORDER = &H200
Private Const SWP_NOSIZE = &H1
Private Const SWP_NOZORDER = &H4
Public Function ThinBorder(ByVal lhWnd As Long, ByVal bState As Boolean)
Dim rtnVal As Long
rtnVal = GetWindowLong(lhWnd, GWL_EXSTYLE)
If Not (bState) Then
rtnVal = rtnVal Or WS_EX_CLIENTEDGE And Not WS_EX_STATICEDGE
Else
rtnVal = rtnVal Or WS_EX_STATICEDGE And Not WS_EX_CLIENTEDGE
End If
SetWindowLong lhWnd, GWL_EXSTYLE, rtnVal
SetWindowPos lhWnd, 0, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE Or _
SWP_NOOWNERZORDER Or SWP_NOZORDER Or SWP_FRAMECHANGED
End Function
'-- End --'
Public Sub OfficeThinBorder(ByVal lhWnd As Long, ByVal bState As Boolean)
'Crée un bord de composants au style Office 2000
'Mettre BorderStyle à 0 du contrôle pour voir de l'effet...
'Exemple :
'OfficeThinBorder Text1.Hwnd, True '<= Applique le Style Office 2000
'OfficeThinBorder Text1.Hwnd, False '<= Enlève le Style Office 2000
ThinBorder lhWnd, bState
End Sub Eric De Decker
vbg.be@vbgroup.nl
Licence And Copy Protection AxtiveX
Source CodeBook for the programmer