See Also Example
Applies To
Check box, combo box
Description
Determines the icon
Usage
[form.]control.DragIcon[ = icon ]
Where icon is any code 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
Setting
The DragIcon property settings are:
Setting Description
(none) (Default) An arrow pointer inside a rectangle.
Icon A custom mouse pointer. You specify the icon by loading 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 file-name extension and format.
Remarks
DragIcon is useful for providing visual feedback during a dragging operationfor example, to indicate that the source control is over an appropriate target. DragIcon takes effect when the user initiates dragging. 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.
Data Type
Integer
Help:
Drag Method
DragDrop Event
DragMode Property
LoadPicture Function
Programmer's Guide:
Chapter 12, "Responding to Mouse Events"
Appendix B, "Icon Library"
The example changes the drag icon each time you drag a picture control. To try this example, paste the code into the Declarations section of a form that contains a picture control. Set DragMode = 1. Then press F5 and click and drag the picture control.
Sub Form_DragDrop (Source As Control, X As Single, Y As Single)
Dim Pic ' Declare variable.
Source.Move X, Y ' Set position of control.
Pic = "icons\office\crdfle01.ico" ' Get name of icon file.
If Source.DragIcon = False Then ' If no picture loaded.
Source.DragIcon = LoadPicture(Pic)' Load picture.
Else
Source.DragIcon = LoadPicture() ' Unload picture.
End If
End Sub