We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Polyline Tool right click event and Node Selection in a diagram

Thread ID:





67074 Aug 8,2007 09:36 AM UTC Aug 10,2007 12:25 AM UTC WinForms 1
Tags: Diagram
Elia Chkayra
Asked On August 8, 2007 09:36 AM UTC

Hello again,

I tried this time to use the polyline tool, i noticed that when a right click occurs, the tool automatically groups the drawed line, i want to add a feature on the righr click event wich allows me to connect the polyline begining point and the polyline ending point it they are spaced and then group the object created.

And Also when i use the select tool to select a node, i want to be able to access this selected node, wich function do i have to use. for example i select a node, when i right click on the selected node a menu appears, i choose a number in this menu and the programs will draw copies of the selected node according to the number chosen.

I appreciate your help, Thank you

J.Nagarajan [Syncfusion]
Replied On August 10, 2007 12:25 AM UTC

Hi Elica,

Thanks for your continued interest in SYncfusion product.

If you want to connect the first and last point of the polyline, When you right click on the the diagram model then you have to derive PolyLineBase and PolyLineTool classes. In the Mouse up event of PolyLineTool class you can assign the first and last point of the polyline. Please refer to the following code snippet

public override Tool ProcessMouseUp( MouseEventArgs evtArgs )
if( evtArgs.Button == MouseButtons.Right )
if( this.Points.Length > c_nMIN_NODE_POINTS )
// set InAction property before adding node to document
this.InAction = false;
// complete action
PointF[] pt = this.Points;
pt[pt.Length - 1] = pt[0];

CompleteAction( pt );
toolToReturn = base.ProcessMouseUp( evtArgs );

I have attached the sample that demonstrates this completely. In this sample when you click on Tools->LinkSymbol menuitem, you can activate the polyline tool. You can download the sample from the following page


Please refer to it and let me nmow if you have any questions.

2. If you want to access the selected node then please refer to the following code snippet

public delegate void NodeSelection(object sender, CollectionExEventArgs evtargs);
public event NodeSelection nodeselection;
public MainForm()
this.nodeselection += new NodeSelection(MainForm_nodeselection);
void MainForm_nodeselection(object sender, CollectionExEventArgs evtargs)
if (this.diagram1.Controller.SelectionList.Count > 0)
Node node = this.diagram1.Controller.SelectionList.Last as Node;
this.richTextBox1.Text = node.Name;

//NodeCollectionChanged event
void EventSink_NodeCollectionChanged(CollectionExEventArgs evtArgs)
DiagramController controller = this.diagram1.Controller;
Node node = evtArgs.Element as Node;
if (node != null)
if (node == controller.SelectionList.First)
//Fire the NodeSelection event

I have attached the sample that demonstrates this completely. In this sample when you select a node, the name of selected will appear in the textbox. You can download the sample from the following page


Please let me know if you have any questions.



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon