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


ITool.OnContextMenu Method (ArcObjects .NET 10.4 SDK)
ArcObjects Library Reference (SystemUI)  

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,
  VARIANT_BOOL* handled
);
[C++]

Parameters x [in] x is a parameter of type long y [in] y is a parameter of type long handled [out, retval] handled is a parameter of type VARIANT_BOOL

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