help with where the item will be dropped during drag drop

T

Tarscher

Hi all,

Users can rearrange a listbox by a drag drop operation. All is
implemented but it's not always easy for the user to know where
exactly he is dropping his item. Does .net provide you with some sort
of functionality that indicates where you will drop your item?

Eg: when the user hovers between 2 items (Item3 and 4 here) a line
shows that it will be dropped between those 2 items. Can this be done?

Item1
Item2
item3
 
C

ClayB

Not sure how you are doing your D&D, but if you are using the Control
D&D events, one simple thing you could do is to move the selection are
you move the drop as below. To display a little line at the insertion
point would require more work.

void listBox2_DragOver(object sender, DragEventArgs e)
{
Point pt = this.listBox2.PointToClient(new Point(e.X, e.Y));
int index = this.listBox2.IndexFromPoint(pt);
if (index > -1 && index < list2.Count)
this.listBox2.SelectedIndex = index;
}
===============
Clay Burch
Syncfusion, Inc.
 

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