Hur kommer man åt att sätta t.ex. en MouseEnter/MouseLeave-event på en enskild knapp i en toolbar?? en liten url med en kanske lösning:Problem med toolbar
På en vanlig knapp har jag fått det fungera fast jag kommer inte åt knappen i tollbaren riktigt, kan bara sätta eventen på hela toolbaren i så fall.
Tack på förhand!Sv: Problem med toolbar
http://groups.google.se/groups?hl=sv&lr=&ie=UTF-8&oe=UTF-8&threadm=Xns92757025A8E9Ccrtimmonscrtimmonsin%40207.46.239.39&rnum=1&prev=/groups%3Fq%3D%2522C%2523%2522%2B%252Btoolbar%2B%252Bmouseenter%26hl%3Dsv%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26selm%3DXns92757025A8E9Ccrtimmonscrtimmonsin%2540207.46.239.39%26rnum%3D1
---snipp----
This sets the text of a status bar panel equal to the tag property of
toolbar button over which the mouse is moving:
<code>
Private Function FindToolBarButtonTagUnderPoint(ByVal pt As Point) As String
Dim i As Integer
Dim ReturnString As String = "No Button Under Me"
For i = 0 To ToolBar1.Buttons.Count - 1
If ToolBar1.Buttons(i).Rectangle.Contains(pt) Then
ReturnString = ToolBar1.Buttons(i).Tag.ToString
End If
Next
Return ReturnString
End Function
Private Sub ToolBar1_MouseMove(ByVal sender As Object, _
ByVal e As System.Windows.Forms.MouseEventArgs) _
Handles ToolBar1.MouseMove
Me.StatusBarPanel1.Text = FindToolBarButtonTagUnderPoint(ToolBar1.PointToClient(Cursor.Position))
End Sub
</code>
---snipp---