listBox中的项目不希望被拖出 [英] The items in listBox do not want to be dragged out

查看:93
本文介绍了listBox中的项目不希望被拖出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
如何进行拖动在C#/WindowsForms中从一个列表拖放到另一个列表?

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆