Модератор: BV
hCORe писал(а):MS Windows Common Controls используй версию 5.0 (SP2) и по возможности откажись от работы с кнопками графического стиля (Style = Graphical). Или используй для них сабклассинг
'Установим константы
Public Const WM_USER = &H400
Public Const TB_SETSTYLE = WM_USER + 56
Public Const TB_GETSTYLE = WM_USER + 57
Public Const TBSTYLE_FLAT = &H800
Public Const TBSTYLE_TOOLTIPS = &H100
Public Const TBSTYLE_WRAPABLE = &H200
Public Const TBSTYLE_ALTDRAG = &H400
Public Const TBSTYLE_LIST = &H1000
Public Const TBSTYLE_CUSTOMERASE = &H2000
'Объявим функции
Public Declare Function SendMessageLong Lib "user32" Alias "SendMessageA" _
(ByVal hWnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) As Long
Public Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" _
(ByVal hWnd1 As Long, _
ByVal hWnd2 As Long, _
ByVal lpsz1 As String, _
ByVal lpsz2 As String) As Long
'Сделать плоский тулбар
Public Sub FlatBar(ByVal tb As ToolBar)
Dim style As Long
Dim hToolbar As Long
Dim R As Long
hToolbar = FindWindowEx(tb.hWnd, 0&, "ToolBarWindow32", vbNullString)
style = SendMessageLong(hToolbar, TB_GETSTYLE, 0&, 0&)
If style And TBSTYLE_FLAT Then
style = style Xor TBSTYLE_FLAT
Else: style = style Or TBSTYLE_FLAT
End If
R = SendMessageLong(hToolbar, TB_SETSTYLE, 0, style)
tb.Refresh
End Sub
Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 33