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 and drop grid

I am inheriting the dndgrid class for my grid, when I drag over my grid it draws a rectangle around the visible cells. Dim r As Rectangle = Me.RangeInfoToRectangle(Me.ViewLayout.VisibleCellsRange) r = New Rectangle(r.X + w - 2, r.Y + w - 2, r.Width - 2 * (w - 2), r.Height - 2 * (w - 2)) g.DrawRectangle(p, r) I need instead to draw a rectangle around the three rows that make up one record in my grid. We are using covered cells and multi rows. I also need to retrieve the RecordID from the datatable that the grid is bound to. Can you help. I think if when I drag over the grid I can collect a range that I may be able to set the selected range, thus be able to find my binder position.

3 Replies

AD Administrator Syncfusion Team June 8, 2005 08:58 AM UTC

I am not sure what dndgrid is? Where did you see it? Do you want this outline to move as you drag, or do you want the outline to be fixed around the original selected record? If you want this outline to move to indicate the potectial drop position, then this is the default behavior of standard OLE dragdrop support in GridControl and GridDataBoundGrid. If this is what you want, it woul dprobably be easier to use this support than trying to implement custom feedback from within your own drag/drop support.


GR Greg June 8, 2005 05:58 PM UTC

I put in the text from my previous posting which works great. In some cases we need to outline only one multi row record and determine the record that we are dropping to from the table that the grid is bound to. Subject: Drop Range By Greg at 5/7/2005 6:39:18 PM I am dragging rows of records from databoundgrid to databoundgrid and firing the dragdrop event to run some updates. I would like to have the whole grid to be outlined instead of a row or cell for the dropshadow. I am not actually transfering any data. Also on the originating grid I would like to be able to click on any part of a row to get the drag cursor instead of just the button. By Clay Burch at 5/7/2005 9:00:09 PM Here is a little sample that I think does something similar to what you described. It uses a derived class so make sure you build the project beofre you try to open the form in the designer. http://www.syncfusion.com/Support/user/uploads/GDBG_DND_678c2cee.zip It turns off the default D&D support and handles the drag and drop so you can cusotmize the behavior. It specifically does not allow a drop on the source grid, but you can change that is you need it.


AD Administrator Syncfusion Team June 9, 2005 12:43 AM UTC

You might try turning on the default D&D support. It frames the target cells. If this works for you, then that woul dbe the simplest way to handle this. If you want to use the previous sample and move the visual que on the target as you move the mouse over the target, this will take some coding. I think you would want to change DrawVisualQue() so it accepts an bool argument eraseQue. You would also need ot add a class member that tracked the position of the last drawn visual que. This could be a row index(es) or a rectangel or ??. Then in DragOver, you would call DrawVisualQue once to erase the old rectangle, an dthen a second time to draw the new rectangle. There will be added complications of trying to handle autoscrolling if you want to support this. Another way you can do this is to create your own mouse controller class based on our defulat support, but tweaked to handle any modifications you want. If you own teh source code, you can check out our code in MouseController\GridDragSelectMouseController.cs

Loader.
Live Chat Icon For mobile
Up arrow icon