RightClick event

Hi,

I want to be able to have a pop-up when the rightmouse button is clicked.

I cannot seem to be able to find an obvious event to use.

Regards

Steve

3 Replies

NG Naganathan Ganesh Babu Syncfusion Team August 1, 2018 06:00 AM UTC

Hi Steve, 
 
We suggest you to use Diagram’s MouseClick event to check whether clicked button as left or right on mouse. Please refer to the below code example. 
 
Code example: 
 
[C#] 
 
//Registering the event... 
diagram1.MouseClick += diagram1_MouseClick; 
 
void diagram1_MouseClick(object sender, MouseEventArgs e) 
{ 
if (e.Button == System.Windows.Forms.MouseButtons.Right) 
{ 
//Add your code logic here... 
MessageBox.Show("Right click"); 
} 
} 
 
Regards, 
 
Naganathan K G 



ST Steve August 2, 2018 11:08 AM UTC

That's great thanks, works a treat.

So, following on from that, how does this work with the 'node' located at that location. I need to show information on a contextmenu that is filtered by the nodes name. I can grab that with the EventSink_NodeClick but no option exists in the diagram1_MouseClick event. 

It's almost as though the NodeClick event is missing the right mouse click event.

Regards

Steve


NG Naganathan Ganesh Babu Syncfusion Team August 3, 2018 05:07 AM UTC

Hi Steve, 
 
We suggest you to use Diagram.Controller’s “GetNodeAtPoint()” method to get the node at current mouse point while right clicking the node and apply your logic to achieve your requirement. please refer to the below attached sample and let us know if your requirement is achieved or not. 
 
Sample: 
 
 
Regards, 
 
Naganathan K G 
 


Loader.
Up arrow icon