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

Possible to truncate labels automatically?

Thread ID:





101304 Oct 13,2011 11:27 AM UTC Oct 17,2011 10:36 AM UTC WinForms 3
Tags: Diagram
Johnathan Tunnicliffe
Asked On October 13, 2011 11:27 AM UTC


I was wondering if I could set Labels on nodes to automatically truncate or get them to not draw outside bounds of parent container (i.e. the node). Ideally i'd be able to put in a '...' for the truncation.

Any help would be appreciated.


Amsath Ali M [Syncfusion]
Replied On October 14, 2011 04:39 AM UTC

Hi Johnathan,

Thanks for using Syncfusion products.

Currently, we don’t have support for ‘Wrapping the text of label'. This has been already confirmed as a Feature Request. For this, please create a DT incident for your query so that we can update the status or patch for the feature.

You can create the DT incident from the following link.

In the interests of maintaining confidentiality, we have a policy of not sharing patches or otherwise proprietary customer specific information in the public Forum.

In the meanwhile, you can use the ‘TextNode’ instead of ‘Label’ inside a node and then grouped it together. Since the label has some limitations in terms of usage of its properties, TextNode was implemented considering to overcome these limitations and also we have 'WrapText' property for TextNode.
Please refer the below code snippet:
Syncfusion.Windows.Forms.Diagram.Rectangle rect1 = new Syncfusion.Windows.Forms.Diagram.Rectangle(300, 100, 90, 50);
Syncfusion.Windows.Forms.Diagram.TextNode tnode = new TextNode('This is an example for TextNode in Rectangle', new RectangleF(20, 0, 50, 50));
tnode.WrapText = true;
tnode.LineStyle.LineColor = Color.Transparent;
tnode.HorizontalAlignment = StringAlignment.Center;
tnode.VerticalAlignment = StringAlignment.Center;

//group the textnode and rectangle
Group grp = new Group();

For your convenience, we have created a simple sample to achieve your requirement.
Please try the below sample and let us know if you have any queries.
INc 85456- Text wrap-73969985.zip

Amsath Ali. M

Johnathan Tunnicliffe
Replied On October 14, 2011 09:22 AM UTC

Is there an option to truncate the text rather than wrap the text? I have 6 labels on my node positioned quite specifically, is the same thing achievable with the TextNode inside my other node?

By truncate I mean this:
Original Text:
This is some long text that i would like to truncate

Truncated (this is what i would like to achieve):
This is some long text ...

This is some long text that
i would like to truncate

Pandi Murugan A [Syncfusion]
Replied On October 17, 2011 10:36 AM UTC

Hi Johnathan,

Thanks for the update.

You can adjust the Label's size to achieve your requirement. Please refer the below code snippet.

Ellipse ellipse = new Ellipse(0, 0, 100, 100);
Syncfusion.Windows.Forms.Diagram.Label lbl = new Syncfusion.Windows.Forms.Diagram.Label();
lbl.Text = "This is long text";
lbl.Size = new SizeF(30, 15);

Here is the sample for your reference.
Please let me know if 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

or the page will be automatically redirected to 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