ArcObjects Library Reference (Controls)  

IMapControlEvents2.OnMouseDown Event

Fires when the user presses any mouse button while over the MapControl.

[Visual Basic 6.0]
Event OnMouseDown(
    ByVal button As Long, _
    ByVal shift As Long, _
    ByVal X As Long, _
    ByVal Y As Long, _
    ByVal mapX As Double, _
    ByVal mapY As Double _
) As Empty
[Visual Basic .NET]
Public Event OnMouseDown As OnMouseDownEventHandler
[C#]
public event OnMouseDownEventHandler OnMouseDown
[C++]
HRESULT OnMouseDown(
  long button,
  long shift,
  long X,
  long Y,
  double mapX,
  double mapY
);
[C++]

Parameters

button [in]   button is a parameter of type long shift [in]   shift is a parameter of type long X [in]   X is a parameter of type long Y [in]   Y is a parameter of type long mapX [in]   mapX is a parameter of type double mapY [in]   mapY is a parameter of type double

Product Availability

Available with ArcGIS Engine.

Description

The OnMouseDown event is triggered when the user presses a mouse button on the MapControl. Use the event to specify actions that will occur when a given mouse button is pressed.

button specifies which mouse button was pressed. 1 for the left mouse button, 2 for the right mouse button, and 4 for the middle mouse button.

shift specifies an integer corresponding to the state of the SHIFT (bit 0), CTRL (bit 1) and ALT (bit 2) keys. When none, some or all of these keys are pressed none, some or all the bits get set. These bits correspond to the values 1, 2, and 4, respectively. For example, if both SHIFT and ALT were pressed, ShiftState would return 5.

x is the X coordinate, in pixels, where the mouse button was pressed referenced against the origin (0, 0) of the MapControl (the top left hand corner).

y is the Y coordinate, in pixels, where the mouse button was pressed referenced against the origin (0, 0) of the MapControl (the top left hand corner).

mapX is the X coordinate, in map units, where the mouse button was pressed referenced against the origin (bottom left hand corner) of the IMapControl2::Map. The values returned are in IMapControl2::MapUnits.

mapY is the Y coordinate, in map units, where the mouse button was pressed referenced against the origin (bottom left hand corner) of the IMapControl2::Map. The values returned are in IMapControl2::MapUnits

Remarks

Use the win32 SetCapture function to continue receiving mouse events (until the mouse is released) when the mouse is moved outside the control's display area. The win32 ReleaseCapture function releases the mouse.

See Also

IMapControlEvents2 Interface