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

Drag Drop Cell location

Hi, I would like to be able to drag and drog several rows from one grouping grid onto another one. Nevertheless I want to be able to allow the drop only when the mouse goes over a parent row in the destination grid. I am using the code below to find out the current location based on the cursor position: [c#] // Convert the screen coordinates into the grid coordinates System.Drawing.Point ptGrid = gridMain.PointToClient(new System.Drawing.Point(e.X,e.Y)); // Get the row and column from that point int RowIndex, ColIndex; gridMain.TableControl.PointToRowCol(ptGrid,out RowIndex, out ColIndex); I have noticed a strange behaviour with the values returned by the PointToRowCol funstion: The column index returned is always that of the parent table column, even when the mouse is currently on a child table record. I would have expected it to return me the column index of the child record when the pointer is over a child row... Also, I have not found a way yet to get a handle on the actual record corresponding to the RowIndex (bearing in mind that this record can be a parent record or a child record). Hope you can help.

2 Replies

AD Administrator Syncfusion Team March 9, 2005 05:33 PM UTC

Hi, I uploaded a modified HierarchySample. See HierarchySampleWithHitTest.zip It contains sample code that listens for MouseMove events and then calls a helper method to determine the display element and the column under the cursor and dumps the info to the output window. PointToRowCol itsself does not work for nested tables because the nested tables are actually just a big covered range within the parent table control. Stefan


AD Administrator Syncfusion Team March 9, 2005 08:42 PM UTC

Just fyi. For the next release we also added some helper routines that will make this easier. You can then simply call private void TableControl_MouseMove(object sender, MouseEventArgs e) { Point ptClient = new Point(e.X, e.Y); GridTableControl tableControl = this.groupingGrid1.TableControl; GridTableCellStyleInfo style = tableControl.PointToTableCellStyle(ptClient); Element displayElement = style.TableCellIdentity.DisplayElement; } Stefan >Hi, > >I uploaded a modified HierarchySample. See >HierarchySampleWithHitTest.zip > >It contains sample code that listens for MouseMove events and then calls a helper method to determine the display element and the column under the cursor and dumps the info to the output window. > >PointToRowCol itsself does not work for nested tables because the nested tables are actually just a big covered range within the parent table control. > >Stefan >

Loader.
Live Chat Icon For mobile
Up arrow icon