Context menu event occured at the given xy location.
[Visual Basic 6.0] Function OnContextMenu(
ByVal x As Long, _
ByVal y As Long _
) As Boolean
[Visual Basic .NET] Public Function OnContextMenu ( _ ByVal x As Integer, _ ByVal y As Integer _ ) As Boolean
[C#] public bool OnContextMenu ( int x, int y );
[Java] public Boolean onContextMenu ( int x, int y ) throws IOException, AutomationException
[C++]
HRESULT OnContextMenu(
long x,
long y,
VARIANT_BOOL* handled
);
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
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.
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.
Your class code could include something like the following code.
Private Function ITool_OnContextMenu(ByVal X As Long, ByVal Y As Long) As Boolean
' Add some code to show a custom context menu when there is a right click.
' This example creates a new context menu with one macro item on it.
Dim pShortCut As ICommandBar
Dim pitem As ICommandItem
' Create a new context menu. m_pApp is set in ICommand_OnCreate.
Set pShortCut = m_pApp.Document.CommandBars.Create("MyShortCut", esriCmdBarTypeShortcutMenu)
' Add an item to it
Set pitem = pShortCut.CreateMacroItem("MyMacro", 4)
' Display the menu
pShortCut.Popup
' Let the application know that you handled the OnContextMenu event.
' If you don't do this, the standard context menu will be displayed after
' this custom context menu.
ITool_OnContextMenu = True
End Function