开发者

How to drag and drop list view items from one app to another?

开发者 https://www.devze.com 2023-04-06 20:45 出处:网络
There is one win forms application wi开发者_开发知识库th some list view items. I\'d like to drag several selected items from that app to my another win forms app.

There is one win forms application wi开发者_开发知识库th some list view items. I'd like to drag several selected items from that app to my another win forms app. Each list view item should contain some custom data and recieving app needs to get it also.


For a lengthy example, see MSDN, Control.DoDragDrop Method. Important for your specific task is

  • Call yourDragSourceControl.DoDragDrop(data, effects) with the data you want to transfer to the drop target. You can specify any serializable object or a string.
  • You deserialize the transferred data in the handler of the DragDrop event of the drop target; use var data = (YourDTO)e.Data.GetData(typeof(YourDTO));
0

精彩评论

暂无评论...
验证码 换一张
取 消