listBox中的项目不希望被拖出 [英] The items in listBox do not want to be dragged out
问题描述
Possible Duplicate:
How to make drag-and-drop from one list to another in C#/WindowsForms?
我试图使2个listBoxes(使用WinForms)能够将一个窗体拖放到另一个窗体,但是即使将listBoxes的属性"AllowDrop"设置为True后,一个listBox中的项也不希望将其拖出-光标不变,并且没有调用DragLeave,DragDrop等方法.
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.
我想念什么吗?
如果您要我添加一些代码,请发表评论.
please comment if you want me to add some code.
推荐答案
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)
这篇关于listBox中的项目不希望被拖出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!