Drag and Drop
LEADTOOLS provides properties and events that support the drag and drop process in the ImageList control and in the Main control. The properties and events of the ImageList control let you drag an image that is open in one ImageList control and drop it in another ImageList control. The properties and events of the Main control let you drag an image that is open in one Main control and drop it in another Main control.
To begin the drag and drop process, you must enable the process by setting the EnableOLEDragMethod property (Main Control) or the EnableOLEDragMethod property (ImageList Control) to TRUE, depending on the control you are using. If you are working with the ImageList control you must also set the AllowSelection property to ALLOWSELECTION_SINGLE.
With the drag and drop process enabled, select an image within the ImageList control or press the left mouse button within the Main control and begin dragging. This will generate the OnOLEStartDrag event (ImageList control) if you are working with the ImageList control, or it will generate the OnOLEStartDrag event (Main Control) if you re working with the Main control.
As you continue to drag the image, two more events are generated repeatedly for each control. If you are working in the ImageList control the OnOLEDragOver event (ImageList Control) and the OnOLEGiveFeedback event (ImageList Control) are generated. If you are working with the Main Control, the OnOLEDragOver event (Main Control) and the OnOLEGiveFeedback event (Main Control) are generated. The OnOLEDragOver event receives information concerning the button(s) used in the dragging process and the location of the cursor during the dragging process. The OnOLEGiveFeedback event receives a parameter that is used to indicate which cursor to use during the dragging process. By setting the parameter received by the OnOLEGiveFeedback event to FALSE, a custom cursor can be displayed during the dragging process. The custom cursor that will be used in this case is set in the OLEDragCursor property (Main Control) for the Main control or the OLEDragCursor property (ImageList Control) for the ImageList control.
When the dragging process is finished and you drop the image into the target control, an OnOLECompleteDrag event (Main Control) or OnOLECompleteDrag event (ImageList Control) is generated.