This document is archived and information here might be outdated. Recommended version. |
ArcObjects Help for .NET developers > ESRI.ArcGIS.Snippets > Snippets > MapControl Left and Right Mouse Clicks Snippet (ArcObjects .NET 10.4 SDK) |
Stub code for using left and right mouse clicks for ESRI.ArcGIS.Controls.IMapControlEvents2_OnMouseDownEvent.
///<summary>Stub code for using left and right mouse clicks for ESRI.ArcGIS.Controls.IMapControlEvents2_OnMouseDownEvent.</summary> /// ///<param name="e">An ESRI.ArcGIS.Controls.IMapControlEvents2_OnMouseDownEvent.</param> /// ///<remarks>e is obtained as the result of the AxMapControl.OnMouseDown event.</remarks> public void MapControlLeftAndRightMouseClicks(ESRI.ArcGIS.Controls.IMapControlEvents2_OnMouseDownEvent e) { if (e.button == 1) // Left mouse click { // TODO: Your implementation code..... } if (e.button == 2) // Right mouse click { // TODO: Your implementation code..... } }
'''<summary>Stub code for using left and right mouse clicks for ESRI.ArcGIS.Controls.IMapControlEvents2_OnMouseDownEvent.</summary> ''' '''<param name="e">An ESRI.ArcGIS.Controls.IMapControlEvents2_OnMouseDownEvent.</param> ''' '''<remarks>e is obtained as the result of the AxMapControl.OnMouseDown event.</remarks> Public Sub MapControlLeftAndRightMouseClicks(ByVal e As 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 End Sub