Link to home
Get AccessLog in
Avatar of codefinger
codefingerFlag for United States of America

asked on

show selected row as the cursor when dragging to another datagrid

I have two datagrids.  I know how to implement the drag drop so that the users can drag a row from one datagrid to the next, but not how to implement the visual effect I want.

I want the selected row's data to show up in a floating disconnected row underneath a hand as it is moved from one grid to the next.

Is that clear?  Any ideas (or links) how to do it?  Am I stretching too far?

Ideas, suggestions, appreciated.

Thanks in advance!
Avatar of CandorZ

I can only give you an idea
1. When the user selects the row(click pressed), draw a rectangle(object - you will have to use a shapecontainer, as in visual basic powerpacks) and put the row contents in it
2. Redraw the rectangle(as it is an object, it wont be painted on the form) while the mouse moves
3. As soon as the click is released, remove the rectangle (object)
You can have a look at sample code on Sample Rectangle Object or Sample Draw Rectangle
Avatar of Jorge Sanchez
Jorge Sanchez
Flag of Ecuador image

Link to home
This content is only available to members.
To access this content, you must be a member of Experts Exchange.
Get Access
Avatar of codefinger


This works pretty close to what I had in mind even though its a little off as far as the image height  (too much of the row above, not enough of the selected -- minor quibble easily fixed with a little trial and error) however, I found that once implemented, it was really difficult to have the app set it back to the default cursor at the appropriate do so, I have to track the whole drag and drop procedure and set the cursor according to its status and what form the mouse is over....(I should have mentioned my datagrids are on two different forms)  
So I have decided today its more trouble than its worth, But it was still a really good answer and right on target.  Bravo!