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.

# Problem with rotate nodes

Hi ,
I am using a diagram and add richtextnodes
I allow the user to turn them (through the context menu)
I save the X,Y,Width,Height and rotation to a database and when the user opens a specific diagram it loads the nodes.
All the nodes that have been rotated have got a different position from the one that user saved

How I save the node
NodeX = Convert.ToInt32(rtxtNode.BoundingRectangle.Location.X);
NodeY = Convert.ToInt32(rtxtNode.BoundingRectangle.Location.Y);
NodeWidth = Convert.ToInt32(rtxtNode.Size.Width);
NodeHeight = Convert.ToInt32(rtxtNode.Size.Height);
NodeRotation = Convert.ToInt32(rtxtNode.RotationAngle);

this.diagram1.BeginUpdate();
RichTextNode richTextNode = new RichTextNode("",
new RectangleF(NodeX,
NodeY,
NodeWidth,
NodeHeight));

richTextNode.RotationAngle = Properties.Settings.Default.Rotation;
diagram1.Model.AppendChild(richTextNode);
this.diagram1.EndUpdate();

In the attached folder you can find a sample and a video how to reproduce the problem

Attachment: Projects_cf8bb82a.7z

3 Replies

SG Shyam G Syncfusion Team October 4, 2019 10:24 AM UTC

Hi George,

To resolve your issue, please use below code example to get the node bounds.

Code example:
 private void btnSave_Click(object sender, EventArgs e)          {              foreach (Node node in diagram1.Model.Nodes)              {                  if (node is RichTextNode)                  {                      RichTextNode rtxtNode = (RichTextNode)node;                      RectangleF nodeBounds = new RectangleF(rtxtNode.PinPoint.X - rtxtNode.PinPointOffset.Width, rtxtNode.PinPoint.Y - rtxtNode.PinPointOffset.Height, rtxtNode.Size.Width, rtxtNode.Size.Height);                    } } }

We have modified the sample and provided below.

Regards,
Shyam G

GE George October 4, 2019 04:13 PM UTC

Thank you

AR Aravind Ravi Syncfusion Team October 7, 2019 11:25 AM UTC

Hi George,

Thanks for the update. Please let us know if you need any further assistance.

Regards
Aravind Ravi