Drag and drop effects on the DataGridView control...

R

RMZ

Dows the DataGridView control provide a way to symbolize the location
between the two rows where the user is targetting a drop? For example,
in iTunes you can drag a song in a set from the bottom of the list to
the top and as you drag it the space between the two rows were it can
insert is symbolized with a solid line, can the grid control do this?

Also is there a way to show the row being draged behind the mouse as
it's being dragged, or at least an outline of some kind, again I'm
looking to recreate the drag and drop behavior I'm seeing in the
Windows iTunes client using the DataGridView.
 
R

RMZ

Doesn't appear the DataGridView can handle this. The only way I found
to to get this effect was to put some code in the DragOver event on my
DataGridView control to make it destroy all rows and rebuild them every
time this DragOver is called, after it builds the list I insert a new
row at the drop location and set its height to a few pixels and then I
set the new rows background color to something that stands out.

This works, it flickers badly, but it works.

To achieve the image drag effect, use the .NET GDI+ methods to create a
small in memory translucent image, then draw the text on the image and
inside DragOver draw it to the screen. Primitive, flickers, but it
works.
 
R

RMZ

Scratch the drag over row insert effect I mentioned.... This doesn't
work when given a large number of rows. If you have a number of rows
beyound the display limits (i.e. if the user has to use a vertical
scroll bar) this doesn't work.

It's a bit upsetting that the DataGridView doesn't even allow a way to
implement this through extensive coding.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top