Hi ,
Thanks for your interest in Syncfusion products.
If your intention is to bring the context menu, then you have to override OnMouseClick() method. Please refer to the below code snippet.
protected override void OnMouseClick()
{
Component component = this.Root as Component;
PointF ptMouseLocation = PointF.Empty;
if (component != null)
{
IContainer container = component.Container;
if (container != null)
{
foreach (Component comp in container.Components)
{
Controls.Diagram diagramControl = comp as Controls.Diagram;
if (diagramControl != null )
{
diagramControl.MouseUp += new MouseEventHandler(diagramControl_MouseUp);
}
}
}
}
}
void diagramControl_MouseUp(object sender, MouseEventArgs e)
{
Diagram.Controls.Diagram diagram = sender as Diagram.Controls.Diagram;
RectangleF m_Bounds = new RectangleF(e.X, e.Y, 1, 1);
if (e.Button == MouseButtons.Right && m_Bounds.IntersectsWith(this.BoundingRectangle))
{
if (diagram.Controller.SelectionList.Count > 0)
m_contextMenu.Show(diagram, new Point((int)diagram.Controller.MouseLocation.X, (int)diagram.Controller.MouseLocation.Y));
else
MessageBox.Show("Please select the Node");
}
}
Here is the working sample.
http://websamples.syncfusion.com/samples/Diagram.Windows/F75853/main.htmPlease let me know if this helps.
Regards,
Nagaraj