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.
Unfortunately, activation email could not send to your email. Please try again.

How do I create a label wider/longer than the symbol to which it is attached.

Thread ID:

Created:

Updated:

Platform:

Replies:

115214 Jan 5,2014 05:50 AM Jan 16,2014 07:42 AM Windows Forms 1
loading
Tags: Diagram
Jan Stiff
Asked On January 5, 2014 05:50 AM

I am currently using something like:


               

public void updateNodeLabel(Node n)

{

     if (n.GetType() == typeof(Ellipse))

{

Ellipse e = (Ellipse)n;

e.Labels.Clear();

WorkUnit wu = (WorkUnit)n.Tag;

string str0 = wu.Name;

Syncfusion.Windows.Forms.Diagram.Label label0 = new Syncfusion.Windows.Forms.Diagram.Label(n, str0);

label0.Position = Syncfusion.Windows.Forms.Diagram.Position.Custom;

label0.OffsetX = (float)(n.BoundingRectangle.Width / 2);

label0.OffsetY = (float)(n.BoundingRectangle.Height / 2) - 20;

label0.FontStyle.Family = defaultDiagramLabelFont;

label0.FontStyle.Size = defaultDiagramLabelSize;

e.Labels.Add(label0);

}

}


However, the program prints the label with a bounding box the same width as the ellipse. This is not appropriate when the label is wider that the ellipse. How do I control the label so that I can choose the width of the label without changing the width of the ellipse?




Amsath Ali M [Syncfusion]
Replied On January 16, 2014 07:42 AM

Hi Jan,

 

Thanks for your interest in syncfusion products.

 

We suggest you to set the Label’s ‘WrapText’ property to false to achieve your requirement. Please refer the below code snippet.

 

Here is the code:

[c#]

Syncfusion.Windows.Forms.Diagram.Label lbl = new Syncfusion.Windows.Forms.Diagram.Label(ellp, "Text in Ellipse");

                lbl.WrapText = false;

                ellp.Labels.Add(lbl);

 

 

Please let us know if you have any queries.

 

Regards,

Amsath Ali. M


CONFIRMATION

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.

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.

;