关于Toolbar的透明样式设置问题!
版本:comctl32.ocx 5.0
以下是我设置透明的代码:
Const WM_USER = &H400
Const TB_SETSTYLE = (WM_USER + 56)
Const TB_GETSTYLE = (WM_USER + 57)
Const TBSTYLE_FLAT = &H800
Const TBSTYLE_TRANSPARENT = &H8000
Private 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
Private Declare Function SendMessage Lib "user32 " Alias "SendMessageA " (ByVal hWnd As Long, ByVal wmsg As Long, ByVal wparam As Long, lParam As Any) As Long
Private Sub Command1_Click()
Dim nStyle As Long
Dim rtn As Long
Dim lWin As Long
lWin = FindWindowEx(Toolbar1.hWnd, 0, "ToolbarWindow32 ", vbNullString)
nStyle = SendMessage(lWin, TB_GETSTYLE, 0&, 0&)
Debug.Print nStyle
nStyle = nStyle Or TBSTYLE_FLAT
Debug.Print nStyle '设置Toolbar平面效果
nStyle = nStyle Or TBSTYLE_TRANSPARENT
Debug.Print nStyle '注:这里打印出来的数值为负数,可能问题出在这里?
rtn = SendMessage(lWin, TB_SETSTYLE, 0&, ByVal nStyle)
Toolbar1.Refresh
End Sub
执行上面的代码后,平面效果是有了,但是透明效果却~~~~~~~~~~~
而且不止没有透明效果,整个Toolbar变成了禁用状态的样子,但是却还可以点击上面的按钮,这个怎么解决?
[解决办法]
用comctl32.ocx 6.0 吧,自带的就有平面效果