Drag-n-drop

  • Thread starter Thread starter Dmitry Karneyev
  • Start date Start date
D

Dmitry Karneyev

Hi!
I use OnMouseDown event to begin drag-n-drop in listbox
but when I call to ListBox.DoDragDrop(params) OnDoubleClick event is not
working.
What I need to do to force OnDoubleClick work?

Thanks.
 
Hi!
I've sorted out it.

I was useing the following OnDoubleClick event holder
if(e.Button == MouseButtons.Left )

Object obj = new Object();

listGoods.DoDragDrop(obj, DragDropEffects.Copy | DragDropEffects.Move);

}

it causes that OnDouble click event doesn't work. DoDragDrop elimanates it

Solution is to watch how many times mouse was clicked my using e.Clicks
property if it's one time - it's our case:

if(e.Button == MouseButtons.Left && e.Clicks == 1 )

Object obj = new Object();

listGoods.DoDragDrop(obj, DragDropEffects.Copy | DragDropEffects.Move);

}

Hope it might be usefull for someone.
 
Back
Top