Compartir a través de


Drag Method

Begins, ends, or cancels a drag operation.

Control.Drag [(nAction)]

Parameters

  • nAction
    Indicates the action to perform. If you omit nAction, nAction is set to 1.

    The settings for the Drag method are:

    Setting Description
    0 Cancel drag operation; restore original position of control.
    1 (Default) Begin dragging the control.
    2 End dragging — that is, drop the control.

Remarks

Usually, the MouseDown event procedure calls the Drag method to begin the dragging operation.

It's necessary to use the Drag method to control dragging only when the DragMode property of the control is set to 0 (Manual). You can use Drag on a control whose DragMode property is set to 1 (Automatic), but the MouseDown and MouseUp events are not triggered.

If you want the mouse pointer to change while the control is being dragged, use either the DragIcon property or the MousePointer property to define the pointer. The MousePointer property only has an effect if the DragIcon property is not set.

See Also

DragDrop Event | DragIcon Property | DragMode Property | MousePointer Property | Move Method

Applies To: CheckBox | ComboBox | CommandButton | CommandGroup | Container Object | Control Object | EditBox | Grid | Image | Label | Line | ListBox | OLE Bound Control | OLE Container Control | OptionButton | OptionGroup | Page | PageFrame | Shape | Spinner | TextBox