Drag and Drop

LEADTOOLS provides properties and events that support the drag and drop process in the ILEADRasteImgList control and in the ILEADRasterView control. The properties and events of the ILEADRasteImgList control let you drag an image that is open in one ILEADRasteImgList control and drop it in another ILEADRasteImgList control. The properties and events of the ILEADRasterView control let you drag an image that is open in one ILEADRasterView control and drop it in another ILEADRasterView control.

To begin the drag and drop process, you must enable the process by setting the EnableOLEDragMethod property (ILEADRasterView) or the EnableOLEDragMethod property (ILEADRasterImgList) to TRUE, depending on the control you are using. If you are working with the ILEADRasterImgList 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 OLEStartDrag event (ILEADRasterImgList) if you are working with the ImageList control, or it will generate the OLEStartDrag event (ILEADRasterView) if you are working with the ILEADRasterView control.

As you continue to drag the image, two more events are generated repeatedly for each control. If you are working in the ILEADRasterImgList control the OLEDragOver event (ILEADRasterImgList) and the OLEGiveFeedback event (ILEADRasterImgList) are generated. If you are working with the ILEADRasterView Control, the OLEDragOver event (ILEADRasterView) and the OLEGiveFeedback event (ILEADRasterView) 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 (ILEADRasterView). Custom cursors can also be used for the ImageList Control. However, in the ImageList control the EnableUseDefaultCursor property must be set to FALSE for the custom cursor in the OLEDragCursor property (ILEADRasterImgList) to be used.

When the dragging process is finished and you drop the image into the target control, an OLECompleteDrag event (ILEADRasterView) or OLECompleteDrag event (ILEADRasterImgList) is generated.