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?
4 Answers
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
Update
And here is the same answer in C#:
private Cursor savedCursor;
private void ToolStripButton1_MouseEnter(object sender, EventArgs e) {
if (savedCursor == null) {
savedCursor = this.Cursor;
this.Cursor = Cursors.UpArrow;
}
}
private void ToolStripButton1_MouseLeave(object sender, EventArgs e) {
this.Cursor = savedCursor;
savedCursor = null;
}

- 64,141
- 14
- 108
- 120
-
Question was about C#. Why is this in VB? – Stealth Rabbi May 10 '16 at 12:44
-
1@StealthRabbi Updated with C# sample – Patrick McDonald May 10 '16 at 15:52
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.

- 5,179
- 3
- 30
- 37
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.

- 11,143
- 1
- 38
- 72
-
You can also wet the cursor back on the OnMouseLeave event for the button(s). – Darryn Frost Feb 10 '22 at 20:45
This is a best Approach:
Private Sub tsbtnGuardar_MouseEnter(sender As Object, e As EventArgs) Handles tsbtnGuardar.MouseEnter
On Error Resume Next
ts.Cursor = Cursors.Hand
End Sub
Private Sub tsbtnGuardar_MouseLeave(sender As Object, e As EventArgs) Handles tsbtnGuardar.MouseLeave
On Error Resume Next
ts.Cursor = Cursors.Arrow
End Sub
where 'ts' is the toolstrip bar, and tsbtnGuardar is a toolstrip button. It worked great for me

- 29
- 3