This document is archived and information here might be outdated.  Recommended version.


Statements - Left and Right Mouse Clicks Snippet (ArcObjects .NET 10.4 SDK)
ArcObjects Library Reference

Statements - Left and Right Mouse Clicks Snippet

Stub code for using left and right mouse clicks for ESRI.ArcGIS.Controls.IMapControlEvents2_OnMouseDownEvent.

[C#]
//<-- Snippet Start -->
// DESCRIPTION:
// Stub code for using left and right mouse clicks for ESRI.ArcGIS.Controls.IMapControlEvents2_OnMouseDownEvent.

if (e.button == 1) // Left mouse click 
{
    //TODO: Your implementation code.....
}

if (e.button == 2) // Right mouse click
{
    //TODO: Your implementation code.....
}

//<-- Snippet End -->
[Visual Basic .NET]
' <-- Snippet Start -->
' DESCRIPTION:
' Stub code for using left and right mouse clicks for ESRI.ArcGIS.Controls.IMapControlEvents2_OnMouseDownEvent.

If e.button=1 Then ' Left mouse click
  ' TODO: Your implementation code.....
End If 

If e.button=2 Then ' Right mouse click
  ' TODO: Your implementation code.....
End If 

' <-- Snippet End -->                

Additional Requirements
  • The code in this document requires the following References added to the Visual Studio project:
  • (NONE)