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

Where is the mouse

Hi, can anyone tell me if there is a quick way to establish which cell the mouse is positioned over? I guess I'm looking for an equivalent to the standard tree control's GetNodeAt(X, Y) method. Thanks in advance David Loomes

2 Replies

AD Administrator Syncfusion Team August 11, 2003 11:36 AM

You can use the GridControl1.PointToRowCol method. Point clickPoint = gridControl1.PointToClient (Cursor.Position); int row, col; gridControl1.PointToRowCol(clickPoint, out row, out col); this.label1.Text = col.ToString();


DL David Loomes August 11, 2003 02:13 PM

Clay, Many thanks, I found this function eventually! There appears to be a problem with the drag/drop behaviour, the DragOver event is unable to change the displayed cursor by changing e.Allowed in the usual way, and DragDrop seems only to be fired after the grid has completed its own drop handling. I managed to get round this by creating my own grid derived from GridControl and overriding OnDragOver and OnDragDrop to pass control to a new event handler. The code (in C++) is below, but this seems like a lot of trouble to go to to get normal drag/drop handling, and inevitably leads to yet another dll in my project. Hope this is of some use! public __gc class MyGridControl : public Syncfusion::Windows::Forms::Grid::GridControl { public: __event DragEventHandler *MyDragOver, *MyDragDrop; Void OnDragDrop(System::Windows::Forms::DragEventArgs __gc *e) { if (MyDragDrop) MyDragDrop->Invoke(this, e); } Void OnDragOver(System::Windows::Forms::DragEventArgs __gc *e) { if (MyDragOver) MyDragOver->Invoke(this, e); } };

Loader.
Live Chat Icon For mobile
Up arrow icon