We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to have a hand cursor on a specified column of datagrid

Thread ID:





869 Aug 27,2002 05:38 AM UTC Jun 13,2005 10:32 PM UTC WinForms 1
Tags: FAQ
Administrator [Syncfusion]
Asked On August 27, 2002 05:38 AM UTC

Hello, 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 End If End If End Sub

Scott Montgomerie
Replied On June 13, 2005 10:32 PM UTC

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 { } my_grid.MouseControllerDispatcher.Add(new MouseControllerDescendant()); 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! Cheers


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon