
Originally Posted by
LinkFX
do you have any ideas for replacing those 3 toolbar buttons?
Can't really see the problem...
If you cannot reach the "internals" of that ToolBar (or ToolBar-like) thingy -
but "have" a hWnd for that "TargetStripe" - then the easiest way probably is:
- to create your own (drawable) Overlay-hWnd (e.g. a VB.PictureBox)
- resizing it to the same size as the "target"
- then placing this OverlayHwnd on the target via SetParent
- but setting your Overlay-hWnd into Disabled-State
The last point above will allow "all MouseClicks to go through to the ParentHwnd...
I don't have the time to fiddle with an Addin-Project-Type now (to give a concrete Demo),
but the following might be sufficient to give you an idea, what I mean...
Into a Form (Form shall contain virginal: Picture1 and ToolBar1 from the MS-CC-V6)
Code:
Option Explicit
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Private Sub Form_Load()
Picture1.BorderStyle = 0
Picture1.AutoRedraw = True
Picture1.Enabled = False
With Toolbar1
.Buttons.Add(1, "Btn1", "Btn1").ToolTipText = "Btn1"
.Buttons.Add(2, "Btn2", "Btn2").ToolTipText = "Btn2"
.Buttons.Add 3, "Sep1", , tbrSeparator
.Buttons.Add(4, "Btn3", "Btn3").ToolTipText = "Btn3"
Picture1.Move 0, 0, Toolbar1.Width, Toolbar1.Height
SetParent Picture1.hWnd, .hWnd
End With
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Me.Caption = Button.Key
End Sub
Private Sub Toolbar1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
Dim Btn As Button
For Each Btn In Toolbar1.Buttons
If x > Btn.Left And x < Btn.Left + Btn.Width And Btn.Visible And Btn.Style <> tbrSeparator Then
Picture1.Cls: Picture1.Line (Btn.Left, Btn.Top)-(Btn.Left + Btn.Width, Btn.Top + Btn.Height), vbRed, B
End If
Next
End Sub
HTH
Olaf