StyleOptionBut




Declare Function GetWindowLong Lib "user32" _
Alias "GetWindowLongA"
(ByVal hwnd As Long, ByVal nIndex As Long) As Long
Declare Function SetWindowLong Lib "user32" Alias _
"SetWindowLongA"
(ByVal hwnd As Long, ByVal nIndex As Long, ByVal _
dwNewLong As Long) As Long
Public Const GWL_STYLE = (-16)
Public Const BS_PUSHLIKE = &H1000&
Procedure
Public Sub SetGraphicStyle(StyleButton As Control, _
Flag As Boolean)
Dim curstyle As Long
Dim newstyle As Long
If Not TypeOf StyleButton Is OptionButton And _
Not TypeOf StyleButton Is CheckBox Then Exit Sub
curstyle = GetWindowLong(StyleButton.hwnd, GWL_STYLE)
If Flag Then
curstyle = curstyle Or BS_PUSHLIKE
Else
curstyle = curstyle And (Not BS_PUSHLIKE)
End If
newstyle = SetWindowLong(StyleButton.hwnd, GWL_STYLE, _
curstyle)
StyleButton.Refresh
End Sub











( styleoptionbut.html )- by Paolo Puglisi - Modifica del 17/12/2023