Find Toolbar Button on Mouse Move

  • Thread starter Thread starter Sakharam Phapale
  • Start date Start date
S

Sakharam Phapale

Hi All,

How to find the Toolbar Button Index in Mouse Move event on Toolbar.


Thanks
Regards
Sakharam Phapale
 
In the event handler on the MouseMove event,



Select Case toolBar1.Buttons.IndexOf(e.Button)

Case 0



Case 1



etc




--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
If U Need My Email ,Ask Me

Time flies when you don't know what you're doing
 
Hi

Thanks for your reply
But, If I am correct then e.Button is nothing but mouse button
e is MouseEventArgs

So following should not work.
Hopes some explanation on this.

Thanks & Ragards
Sakharam Phapale
 
Yes, your right, the only way I can think of is this.

//This will give you the bounding rectangle
toolbar1.Buttons.Item(0).Rectangle


//Use the mousevent args ( X,Y ) and the bounding rectangle to discover
which button it is over, Im sure there must be an easier way

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
If U Need My Email ,Ask Me

Time flies when you don't know what you're doing
 
* "Sakharam Phapale said:
How to find the Toolbar Button Index in Mouse Move event on Toolbar.

From my FAQ:

\\\
Imports System.Windows.Forms
..
..
..
Private Sub ToolBar1_MouseMove( _
ByVal sender As Object, _
ByVal e As MouseEventArgs _
) Handles Me.ToolBar1.MouseMove
Dim b As ToolBarButton
For Each b In Me.ToolBar1.Buttons
If b.Rectangle.Contains(New Point(e.X, e.Y)) Then
If Me.StatusBar1.Text <> b.ToolTipText Then
Me.StatusBar1.Text = b.ToolTipText
End If
Return
End If
Next b
End Sub
///
 
Looks like we had the same idea !

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
If U Need My Email ,Ask Me

Time flies when you don't know what you're doing
 
Hi Terry,

That idea had I also, however the credits are for Herfried, he showed the
code.

:-)

Cor
 
Back
Top