Partilhar via


MouseLeave Event

Occurs when a mouse cursor exits a control

PROCEDURE Object.MouseLeave
LPARAMETERS nButton, nShift, nXCoord, nYCoord

Parameters

  • nButton
    Contains a number that specifies which button was pressed to trigger the event: 1 (left), 2 (right), or 4 (middle).

  • nShift
    Contains a number specifying the state of modifier keys when the mouse is pressed. The valid modifier keys are the SHIFT, CTRL, and ALT keys.

    The values returned in nShift for individual modifier keys are listed in the following table.

    Modifier key values for nShift

    Windows key Value
    SHIFT 1
    CTRL 2
    ALT 4

    If more than one modifier key is held down when the mouse is pressed, the nShift argument contains the sum of the values for the modifier keys. For example, if the user holds CTRL while pressing the mouse button, the nShift argument contains 2. But If the user holds CTRL+ALT while pressing the mouse button, the nShift argument contains 6.

  • nXCoord, nYCoord
    Contains the current horizontal (nXCoord) and vertical (nYCoord) position of the mouse pointer within the form. These coordinates are expressed in terms of the form's coordinate system in the unit of measurement specified by the ScaleMode property of the form.

Remarks

You can use this and the MouseEnter event to create rollover and mouseover behaviors as in DHTML.

A control receives a MouseLeave event when the user moves the mouse out of the control from a mouse position that was previously inside the control. In the case of overlapping or intersecting controls, the topmost control in the z-order receives the event.

A MouseLeave event is passed to objects on forms or toolbars. Forms and toolbars themselves do not receive this event.

See Also

MouseEnter Event | Click Event | DblClick Event | MiddleClick Event | MouseMove Event | MousePointer Property | MouseUp Event | MouseWheel Event

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