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


ITool.OnContextMenu Method (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > SystemUI > ESRI.ArcGIS.SystemUI > Interfaces > IT > ITool Interface > ITool.OnContextMenu Method
ArcGIS Developer Help

ITool.OnContextMenu Method

Context menu event occured at the given xy location.

[Visual Basic .NET]
Public Function OnContextMenu ( _
    ByVal x As Integer, _
    ByVal y As Integer _
) As Boolean
[C#]
public bool OnContextMenu (
    int x,
    int y
);
[C++]
HRESULT OnContextMenu(
  long x,
  long y
);
[C++]
Parameters
x [in]

x is a parameter of type long y [in]
y is a parameter of type long

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Description

X is the X coordinate, in device units, where the right mouse button was pressed.

Y is the Y coordinate, in device units, where the right mouse button was pressed.

Remarks

When implementing ITool to create a custom tool, write code to display a custom context menu when the right mouse button is pressed when this tool is the active tool in the OnContext method.

If your tool displays a custom context menu, it should let the application know that it handled the OnContextMenu event by returning True from the OnContext function. If you don't do this, the standard context menu will be displayed after your custom context menu.

This method does not fire in ArcGIS Engine. A context menu is implemented using IToolbarMenu in ArcGIS Engine as illustrated by the ControlsEditingSketchContextMenu command. 

See Also

ITool Interface