On a datagrid, i try to have a hand cursor when the mouse in hover the second column. The code after don't work ! coud you help me please .....
Private Sub DataGrid1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles DataGrid1.MouseMove
Dim hti As System.Windows.Forms.DataGrid.HitTestInfo
hti = DataGrid1.HitTest(e.X, e.Y)
If hti.Type = System.Windows.Forms.DataGrid.HitTestType.Cell Then
If hti.Column = 1 Then
Cursor.Current = System.Windows.Forms.Cursors.Hand
I have struggled with this for about a day now... I was trying to set event handlers on the MouseMove and MouseLeave events, but I kept getting a flickering in the icon, and it looked like I was fighting with the grid to set the Cursor. I discovered that it was trying to set the cursor to the MouseControllerDispatcher''s DisplayCursor, which was null. It turns out the proper way to fix this is to implement IMouseController:
internal class MouseControllerDescendant: IMouseController
This class then implements a bunch of methods like HitTest, MouseHover, MouseEnter, etc., instead of using the usual event handlers.
Hope this helps somebody and saves them a day of frustration!