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

Coordenates X Y in a textnode

Thread ID:





128514 Jan 26,2017 11:45 AM UTC Jan 27,2017 06:58 AM UTC WinForms 1
Tags: Diagram
Blanca Calderon
Asked On January 26, 2017 11:45 AM UTC


I need to know, when I move a textnode with a keyboard or a mouse event, its coordenates X and Y. Its so important for me to know the correct coordenates because I save them in an .xml document that I use for configurate a display in a PLC.

I used an event :

void EventSink_NodeDoubleClick(NodeMouseEventArgs evtArgs)

Node node = evtArgs.Node;

 int valorX = (int)node.PinPoint.X - (int)node.PinPointOffset.Width;
 int valorY = (int)node.PinPoint.Y - (int)node.PinPointOffset.Height;

But if I try to get the coordenates in a diagram1_mousedown:

private void diagram1_MouseDown(object sender, MouseEventArgs e)

(Node)this.diagram1.Controller.GetNodeUnderMouse(new Point(e.X, e.Y))

int valorX = (int)node.PinPoint.X - (int)node.PinPointOffset.Width;
 int valorY = (int)node.PinPoint.Y - (int)node.PinPointOffset.Height;

I don't get the same values!! Could you help me??

Naganathan Ganesh Babu [Syncfusion]
Replied On January 27, 2017 06:58 AM UTC

Hi Blanca, 
Thanks for contacting Syncfusion support. 
We have created a simple sample to achieve your requirement. We suggest you to use Diagram.Model.EventSink’s “PinpointChanging/PinpointChanged” events and Node’s “BoundingRectangle” property to get the node’s coordinates value while performing the drag/drop operation using mouse/keyboard. Please refer to the below sample and code example. 
Code example: 
diagram1.Model.EventSink.PinPointChanged += new PinPointChangedEventHandler(EventSink_PinPointChanged); 
diagram1.Model.EventSink.PinPointChanging += new PinPointChangingEventHandler(EventSink_PinPointChanging); 
void EventSink_PinPointChanging(PinPointChangingEventArgs evtArgs) 
Node node = evtArgs.NodeAffected as Node; 
float x = node.BoundingRectangle.X; 
float y = node.BoundingRectangle.Y;             
void EventSink_PinPointChanged(PinPointChangedEventArgs evtArgs) 
Node node = evtArgs.NodeAffected as Node; 
float x = node.BoundingRectangle.X; 
float y = node.BoundingRectangle.Y; 
MessageBox.Show("X Value : " + x.ToString() + "\n" + "Y Value : " + y.ToString(), "Nodes Coordinates", MessageBoxButtons.OK); 
Naganathan K G 


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