问题
Possible Duplicate:
How to make drag-and-drop from one list to another in C#/WindowsForms?
I am trying to make 2 listBoxes (with use of WinForms) with ability to drag and drop form one to another but even after setting up the property 'AllowDrop' of the listBoxes to True, the items from one listBox do not want to be dragged out of it - the cursor does not change and none of the DragLeave, DragDrop etc. methods are being called.
Am I missing something ?
please comment if you want me to add some code.
回答1:
You have to call DoDragDrop on the source listBox to start the drag operation. This is usually done in response to some criteria event (i.e. mouse click)
来源:https://stackoverflow.com/questions/8127407/the-items-in-listbox-do-not-want-to-be-dragged-out