Partilhar via


MouseEnter Event

Occurs when a mouse cursor moves into a control

PROCEDURE Object.MouseEnter
LPARAMETERS [nIndex,] 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 MouseLeave event to create rollover and mouseover behaviors as in DHTML.

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

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

See Also

MouseLeave Event | Click Event | DblClick Event | MiddleClick Event | MouseMove Event | MousePointer Property | MouseUp Event | MouseWheel Event | PageFrame Control

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