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

Changing the cursor when dragging over a grid

Hi I have a tree control and when I drag a node off the tree over a grid I want to change the cursor to reflect if the node can be dropped onto the grid. I have set the AllowDrop on the grid and have implemented handlers for the DragDrop and DragOver events for the grid and in the DragOver handler I check for the type of data being dragged over the grid and set the effect to either DragDropEffects.None or DragDropEffects.Copy however setting these see effects makes no difference to the cursor. This code works on other controls but not on the grid. Any ideas ?

3 Replies

AD Administrator Syncfusion Team September 1, 2004 09:58 AM UTC

The grid uses a mouse controller architecture to control cursors. There are two ways you can change the cursor. One is to implement your own mouse controller, and the other is to derive the grid, and override OnSetCursor. Here is a forum thread that has samples for both techniques. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=8551 But since you want to handle a D&D cursor, you have another option. That option is to tie into the grid''s default D&D support by having your dataobject implement IGridDataObjectConsumer. Here is a forum thread that includes a sample that drops a treenode onto a grid using a IGridDataObjectConsumer implmentation. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=5467


AD Administrator Syncfusion Team September 1, 2004 10:00 AM UTC

Oh, one other thing. You existing code may work if you turn off the grid''d default support for D&D. grid.Model.Options.ControllerOptions = grid.Model.Options.ControllerOptions & ~GridControllerOptions.OleDropTarget;


AC Andrew Cross September 1, 2004 10:32 AM UTC

Cheers Turning the grids D&D support off worked Many Thanks Andy >Oh, one other thing. You existing code may work if you turn off the grid''d default support for D&D. > >grid.Model.Options.ControllerOptions = grid.Model.Options.ControllerOptions & ~GridControllerOptions.OleDropTarget; >

Loader.
Live Chat Icon For mobile
Up arrow icon