DragItem.DragPicture

From Xojo Documentation

Property (As Picture )
aDragItem.DragPicture = newPictureValue
or
PictureValue = aDragItem.DragPicture

New in 2011r1

Supported for all project types and targets.

If you assign an image to this property, the picture will be used for the drag instead of the default rectangle. The image will be placed at the top left of the rectangle passed into the DragItem constructor.

Notes

It is only possible to change the DragPicture before calling Drag(), any attempt to do so after that point will fail.

Sample Code

This code sets the DragPicture property just after creating the new DragItem.

In an ImageWell control, put this code in the MouseDown event:

You can then set up the drag in the MouseDrag event of the ImageWell:

Var d As DragItem
d = New DragItem(Self, X, Y, Me.Width, Me.Height)
d.DragPicture = MyPicture // a picture/image added to the project
d.Picture = Me.Image // From the ImageWell control
d.Drag // Allow the drag