在应用程序内拖放/到另一个应用程序

时间:2021-03-17 07:33:09

I have a ListView containing file names. These file names need to be draggable to a TreeView, which is a drag/drop inside the application and works with the built in drag/drop support of Delphi - no problem. But I must also be able to drag/drop the ListView items to another application, e.g. Windows Explorer. This also works, for example using a DragFileSource component of Anders Melander's Component Suite (http://melander.dk) which start its work in the ListView.MouseDown event, so there is not really a drag/drop operation initiated.

我有一个包含文件名的ListView。这些文件名需要可拖动到TreeView,这是一个拖放应用程序内部并使用Delphi的内置拖放支持 - 没问题。但我还必须能够将ListView项目拖放到另一个应用程序,例如Windows资源管理器。这也有效,例如使用Anders Melander的Component Suite(http://melander.dk)的DragFileSource组件,它在ListView.MouseDown事件中开始工作,因此实际上没有启动拖放操作。

Basically, I would need the same behaviour as you can see in a Windows Explorer: You can drag an item to another folder inside the application and also to another application.

基本上,我需要在Windows资源管理器中看到的相同行为:您可以将项目拖动到应用程序内的另一个文件夹以及另一个应用程序。

How can this be done in Delphi? I guess there should be a "drag" initiated, but when the mouse moves outside the app window, it needs to "switch" to the other functionality, and should the mouse move back to the app window, again back to the standard drag drop.

如何在Delphi中完成?我想应该启动一个“拖动”,但当鼠标移动到应用程序窗口之外时,它需要“切换”到其他功能,如果鼠标移回应用程序窗口,再次返回标准拖放。

Thanks for any help!

谢谢你的帮助!

Holger

3 个解决方案

#1


5  

The Drag and Drop Component Suite you mentioned does this. You can initiate a drag which you can drop in your own app or other apps by default. Just pick the right clipboard format that other applications understand. What is your problem with it?

您提到的拖放组件套件就是这样做的。您可以启动拖拽,默认情况下您可以放入自己的应用或其他应用中。只需选择其他应用程序理解的正确剪贴板格式。你有什么问题?

#2


2  

If you want both VCL-style and Windows-style drag and drop, then use the Windows-style one for everything, including drag-and-drop within your own application.

如果你想要VCL风格和Windows风格的拖放,那么就可以使用Windows风格的一切,包括在你自己的应用程序中拖放。

#3


0  

The DropMaster components may help with this - see http://www.raize.com/DevTools/DropMaster/

DropMaster组件可能对此有所帮助 - 请参阅http://www.raize.com/DevTools/DropMaster/

#1


5  

The Drag and Drop Component Suite you mentioned does this. You can initiate a drag which you can drop in your own app or other apps by default. Just pick the right clipboard format that other applications understand. What is your problem with it?

您提到的拖放组件套件就是这样做的。您可以启动拖拽,默认情况下您可以放入自己的应用或其他应用中。只需选择其他应用程序理解的正确剪贴板格式。你有什么问题?

#2


2  

If you want both VCL-style and Windows-style drag and drop, then use the Windows-style one for everything, including drag-and-drop within your own application.

如果你想要VCL风格和Windows风格的拖放,那么就可以使用Windows风格的一切,包括在你自己的应用程序中拖放。

#3


0  

The DropMaster components may help with this - see http://www.raize.com/DevTools/DropMaster/

DropMaster组件可能对此有所帮助 - 请参阅http://www.raize.com/DevTools/DropMaster/