I want to change the user's cursor when they hover over a specific ToolStripButton, but not for the other items on the ToolStrip. How do I set the button's cursor?
You must set the Toolstrip.Cursor property in order to change the cursor. Yes your are right, it will change the mouse cursor for all toolstrip buttons.
In order to get around this, create a OnMouseEnter event for each button on the toolstrip, and then set the cursor for the entire toolstrip to the cursor you want for that particular button.
Because ToolStripItem doesn't inherit from Control, it doesn't have a Cursor property.
You could set the form cursor on the MouseEnter event, and restore the form cursor on the MouseLeave event, VB sample follows:
Dim savedCursor As Windows.Forms.Cursor
Private Sub ToolStripButton1_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles ToolStripButton1.MouseEnter
If savedCursor Is Nothing Then
savedCursor = Me.Cursor
Me.Cursor = Cursors.UpArrow
End If
End Sub
Private Sub ToolStripButton1_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles ToolStripButton1.MouseLeave
Me.Cursor = savedCursor
savedCursor = Nothing
End Sub
Drop down to Win32 and handle WM_SETCURSOR. You can put in your own custom logic to change the cursor based on hit testing for the button. Check this article by Raymond Chen for a better understanding of how the Cursor gets set.