Visual Basic Reference

DragIcon Property

See Also    Example    Applies To

Returns or sets the icon to be displayed as the pointer in a drag-and-drop operation.

Syntax

object.DragIcon [= icon]

The DragIcon property syntax has these parts:

Part Description
Object An object expression that evaluates to an object in the Applies To list.
Icon Any code reference that returns a valid icon, such as a reference to a form's icon (Form1.Icon), a reference to another control's DragIcon property (Text1.DragIcon), or the LoadPicture function.

Settings

The settings for icon are:

Setting Description
(none) (Default) An arrow pointer inside a rectangle.
Icon A custom mouse pointer. You specify the icon by setting it using the Properties window at design time. You can also use the LoadPicture function at run time. The file you load must have the .ico filename extension and format.

Remarks

You can use the DragIcon property to provide visual feedback during a drag-and-drop operation for example, to indicate that the source control is over an appropriate target. DragIcon takes effect when the user initiates a drag-and-drop operation. Typically, you set DragIcon as part of a MouseDown or DragOver event procedure.

Note   At run time, the DragIcon property can be set to any object's DragIcon or Icon property, or you can assign it an icon returned by the LoadPicture function.

When you set the DragIcon property at run time by assigning the Picture property of one control to the DragIcon property of another control, the Picture property must contain an .ico file, not a .bmp file.