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


IEngineNAWindowEventsEx.OnContextMenu Event (ArcObjects .NET 10.6 SDK)
ArcObjects Library Reference (Controls)  

IEngineNAWindowEventsEx.OnContextMenu Event

Indicates if a context menu should be displayed at the given xy location. Return true if handled.

[Visual Basic .NET]
Public Event OnContextMenu As OnContextMenuEventHandler
[C#]
public event OnContextMenuEventHandler OnContextMenu
[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.

Description

The OnContextMenu event is fired when a user right clicks within the IEngineNetworkAnalystEnvironment::NAWindow and can be used to supply a context menu. 

[C#]

public bool OnContextMenu(int x, int y)
{
    //Create a context point at the location of the right mouse click 
    System.Drawing.Point pt=this.PointToClient(System.Windows.Forms.Cursor.Position);
    contextMenu1.Show(this, pt);
    return true;
}

[Visual Basic .NET]

Public Function OnContextMenu(ByVal x As Integer, ByVal y As Integer) As Boolean
    'Create a context point at the location of the right mouse click 
    Dim pt As System.Drawing.Point
    pt=Me.PointToClient(System.Windows.Forms.Cursor.Position)
    contextMenu1.Show(Me, pt)
    Return True
End Function

See Also

IEngineNAWindowEventsEx Interface