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

Update node label position

Thread ID:





96737 Oct 1,2010 03:15 PM UTC Oct 5,2010 01:13 PM UTC WinForms 1
Tags: Diagram
Witold Slirz
Asked On October 1, 2010 03:15 PM UTC

Im using this code to calculate node's label position:

label.Position = Position.Custom;
label.OffsetX = node.Size.Width / 2;
label.OffsetY = node.Size.Height + 20;

How to recalculate label position automatically when user resize node?

Pandi Murugan A [Syncfusion]
Replied On October 5, 2010 01:13 PM UTC

Hi Witold,

Thank you for your interest in Syncfusion Products.

We suggest you to use Diagram DocumentEventSink's SizeChanged event to update the Node's Label position. Please refer the below code snippet.

public Form1()
((DocumentEventSink)diagram1.Model.EventSink).SizeChanged+=new SizeChangedEventHandler(Form1_SizeChanged);

void Form1_SizeChanged(SizeChangedEventArgs evtArgs)
//update the label position here
PathNode node = evtArgs.NodeAffected as PathNode;
if (node.Labels.Count > 0)
if (node.Labels[0] != null)
node.Labels[0].OffsetX = node.Size.Width / 2;
node.Labels[0].OffsetY = node.Size.Height + 20;

For your convenience, we have created a simple sample and the same can be downloaded from below link.


Please let me know if you have any concerns.

Pandi Murugan A


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