Drag-n-Drop with ListBox

  • Thread starter Thread starter Jacob W Anderson
  • Start date Start date
J

Jacob W Anderson

Hi all,

I want to setup a drag source in a Windows.Forms.ListBox
control, but I don't see any docs on how to do this.
Unlike the TreeView, the ListBox has no ItemDrag event
handler, so it looks like I have to use the MouseDown
event. Is that correct:

if(_listSpec.SelectedItem != null)
{
DoDragDrop(_listSpec.SelectedItem,
DragDropEffects.Copy);
}

The problem with this model is that in the drag
destination, the drag value is always the first item in
the source list (_listSpec).

Does anybody have some sample code for implementing a
ListBox as a drag source? (in C# preferably)

Thanks

-- Jake
(e-mail address removed)
 
Back
Top