[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Ian Post

6/2/2011 3:45:00 PM

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.


2 Answers

mm

6/4/2011 1:37:00 AM

0

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


Ian Post

6/4/2011 4:17:00 AM

0

Thank you very much.
My solution worked except for the dead area on a multi-row toolbar.
Yours works perfectly.