El 02/06/2011 12:45 p.m., BeeJ escribió:
> Is there a way to get the Toolbar Button Index or Key when hovering the
> mouse over the button? SendMessage? I see no HitTest or similar.
> The Toolbar wraps when the form is resized.
>
Private Sub Toolbar1_MouseMove(Button As Integer, Shift As Integer, _
x As Single, y As Single)
Dim iIndex As Integer
iIndex = GetToolbarButtonIndex(Toolbar1, x, y)
If iIndex > 0 Then
Caption = iIndex
Else
Caption = "..."
End If
End Sub
Private Function GetToolbarButtonIndex(nToolBar As Toolbar, _
x As Single, y As Single) As Integer
Dim c As Long
For c = 1 To nToolBar.Buttons.Count
If x > nToolBar.Buttons(c).Left Then
If x < (nToolBar.Buttons(c).Left +
_nToolBar.Buttons(c).Width) Then
If y > nToolBar.Buttons(c).Top Then
If y < (nToolBar.Buttons(c).Top + _
nToolBar.Buttons(c).Height) Then
GetToolbarButtonIndex = c
Exit For
End If
End If
End If
End If
Next c
End Function