The items in listBox do not want to be dragged out [duplicate]

穿精又带淫゛_ 提交于 2019-12-25 19:04:22

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!