DragIcon Property

See Also9O068CD                 Example6IWG6W>Low

Applies To

Check box9P3BU5, combo box1YZXFF6, command buttonXJSPC0, data control2E1FEX3, directory list boxO9U5A0, drive list box5WJO0PW, file list box1M6S8UX, frame1KX6ZP8, grid2VGT0PT, horizontal scroll bar1JSJOS7, image9A4FCA, label3MNIZ8D, list boxG11UCK, OLE control2HQDVVU, option buttonJYBO08, picture box31MYIWX, text boxYPYZDG, vertical scroll bar1JSJOS7.

Description

Determines the icon529QBG to be displayed as the pointer in a drag-and-drop operation1MXLXNZ.

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 LoadPicture1F02FRP function.

Setting

The DragIcon property settings are:

Setting     Description

 

(none)       (Default) An arrow pointer inside a rectangle.

Icon          A custom mouse pointer.  You specify the icon13Z8KW6 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 MouseDownD0VNMJ or DragOver2TUGMAC event procedure.

 

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

 

Data Type

IntegerDOKXHY


See Also

Help:

Drag Method2IEV8PA

DragDrop Event1EBOJGL

DragMode PropertyS9LGP1

LoadPicture Function1F02FRP

 

Programmer's Guide:

Chapter 12, "Responding to Mouse Events"

Appendix B, "Icon Library"


DragIcon Property Example

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