Dragging and dropping covered ranges

Right now, by default (at least in grid pad), if you have a covered range of cells and start a drag, the grid only considers the top-left cell as part of the drag and thus only the top-left cell is moved. This makes things inconvenient for cells with images, for example, because you want to spread an image over several cells, but every time you drag the covered range, the destination is not covered and the image is squished in to one cell. How would I implement drag-drop of covered ranges in a way similar to excel? That is, when you start a drag of a covered range, the whole range is dragged and after the drop, the resulting range is also covered. In essence, you are moving the covered range around.

1 Reply

AD Administrator Syncfusion Team December 4, 2005 10:41 AM UTC

If you are dragging within the same grid, you can use class members to communicate the information needed to handle this. One way to do this is to handle the QueryOleDataSource event and there save the covered range as a GridData object and also save the original location. Then in the DragDrop event, you can put this GridData object at its new location. Here is a minimal sample that shows how you can go about this. http://www.syncfusion.com/Support/user/uploads/GC_DragCoveredRanges_bb92e5bf.zip If you want to do this across GridControls, then the idea would be the same, but you would have to use OLE dataobjects to communicate the required objects between QueryOleDataSource in teh source grid and DragDrop in the target grid.

Loader.
Up arrow icon