Share via


MouseMove event

Occurs when the mouse is moved while the pointer is over the map. A button does not need to be pressed for this event.

Applies to

Objects: Map, MappointControl

Syntax

object.MouseMove(Button, Shift, X, Y)

Parameters

Part

Description

object

An expression that evaluates to a Map or MappointControl object.

Button

ByVal Long. An integer that corresponds to the state of the mouse buttons. A bit is set if the button is down. The Button argument is a bit field with bits corresponding to:

GeoMouseButtonConstantsDescriptionValueBit
geoLeftButtonLeft button10
geoMiddleButtonMiddle button42
geoRightButtonRight button21
geoXButton11st X button83
geoXButton22nd X button164

Indicates the complete state of the mouse buttons: some, all, or none of these five bits can be set, indicating that some, all, or none of the buttons are pressed.

Shift

ByVal Long. An integer that corresponds to the state of the SHIFT, CTRL, and ALT keys. A bit is set if the key is down. The Shift argument is a bit field with the least-significant bits corresponding to:

GeoShiftConstantsDescriptionValueBit
geoAltMaskALT key42
geoCtrlMaskCTRL key21
geoShiftMaskSHIFT key10

Indicates the state of these keys: some, all, or none of the bits can be set, indicating that some, all, or none of the keys are pressed. For example, if both CTRL and ALT were pressed, the value of Shift would be 6.

X

ByVal Long. The X coordinate of the mouse pointer relative to the map window, in pixels.

Y

ByVal Long. The Y coordinate of the mouse pointer relative to the map window, in pixels.

Remarks

  • Do not make this event infinitely recursive by calling itself or causing itself to be called.

  • Do not create a modal dialog box—including message boxes—during this event.

Example

  'This code requires that you have a list box on your form
  Dim WithEvents objApp As MapPoint.Application
  Dim WithEvents objMap As MapPoint.Map

  Private Sub Form_Load()
    'Set up the application
    Set objApp = CreateObject("mappoint.application")
    Set objMap = objApp.ActiveMap
    objApp.Visible = True
    objApp.UserControl = True
  End Sub

  Private Sub objMap_MouseDown(ByVal Button As Long, ByVal Shift As Long, ByVal X As Long, ByVal Y As Long)
    List1.AddItem "MouseDown event fired"
  End Sub

  Private Sub objMap_MouseMove(ByVal Button As Long, ByVal Shift As Long, ByVal X As Long, ByVal Y As Long)
    List1.AddItem "MouseMove event fired"
  End Sub

  Private Sub objMap_MouseUp(ByVal Button As Long, ByVal Shift As Long, ByVal X As Long, ByVal Y As Long)
    List1.AddItem "MouseUp event fired"
  End Sub