拖放代码 [英] The code of Drag and drop
本文介绍了拖放代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在c#中将项目一个文本拖到另一个文本的代码。对于windows表单,请检查这些
简单的拖放如何示例 [ ^ ]
http:// stackoverflow .com / questions / 11407068 /如何从一个面板拖放一个按钮到另一个面板 [ ^ ]
你有两个控件:一个源和一个目标。
1)设置目标'的Control.AllowDrop [< a href =http://msdn.microsoft.com/en-us/library/system.windows.forms.control.allowdrop.aspxtarget =_ blanktitle =New Window> ^ ]属性为true。
2)通过调用Control.DoDragDrop [ ^ ]方法。您要传输的数据存储在一个对象中,您将该方法作为参数。
3)使用目标'的DragEnter [ ^ ]和DragDrop [ ^ ]事件。事件参数包含您之前在拖放过程中放置的数据。根据需要随意使用。
I want to code of drag the item one text to another in c#. plz rply
解决方案
for windows forms, check these
A Simple Drag And Drop How To Example[^]
http://stackoverflow.com/questions/11407068/how-to-drag-and-drop-a-button-from-one-panel-to-another-panel[^]
You have two controls: a source and a target.
1) Set the target''s Control.AllowDrop[^] property to true.
2) Start the drag''n''drop process in the source by calling its Control.DoDragDrop[^] method. The data you want to transfer is stored in an object that you give the method as a parameter.
3) Use the target''s DragEnter[^] and DragDrop[^] events. The event arguments contain the data that you put in the drag''n''drop process earlier. Do with it as you need.
这篇关于拖放代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文