Customizing Drag and Drop with a Drag Object
You can use a TDragObject to customize an object's drag-and-drop behavior. The standard drag-over and drag-and-drop events indicate the source of the dragged item and the coordinates of the mouse cursor over the accepting control. To get additional state information, derive a custom drag object from TDragObject or TDragObjectEx and override its virtual methods. Create the custom drag object in the OnStartDrag event.
Normally, the source parameter of the drag-over and drag-and-drop events is the control that starts the drag operation. If different kinds of control can start an operation involving the same kind of data, the source needs to support each kind of control. When you use a descendant of TDragObject, however, the source is the drag object itself; if each control creates the same kind of drag object in its OnStartDrag event, the target needs to handle only one kind of object. The drag-over and drag-and-drop events can tell if the source is a drag object, as opposed to the control, by calling the IsDragObject function.
TDragObjectEx descendants are freed automatically whereas descendants of TDragObject are not. If you have TDragObject descendants that you are not explicitly freeing, you can change them so they descend from TDragObjectEx instead to prevent memory loss.
Drag objects let you drag items between a form implemented in the application's main executable file and a form implemented using a DLL, or between forms that are implemented using different DLLs.