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.

Rotate Label in a Group

Thread ID:

Created:

Updated:

Platform:

Replies:

101074 Sep 23,2011 08:45 AM Sep 26,2011 05:00 AM ASP.NET Web Forms (Classic) 1
loading
Tags: DiagramWebControl
John McAteer
Asked On September 23, 2011 08:45 AM

Hello

I have a node Group that contains labels.

Can I rotate a Label to the vertical?

Or do I need to put the label in a container node and rotate the Container?

Thanks
John


Amsath Ali M [Syncfusion]
Replied On September 26, 2011 05:00 AM

Hi John,

Thanks for using Syncfusion products.

1. We suggest you to use the ‘TextNode’ instead of using Label to rotate the text in vertical because the TextNode contains the property of “DirectionVertical” to rotate the text in vertical when it is set to ‘true’. Please refer the below code to achieve your requirement.

Here is the code snippet:
[C#]
//Textnode
TextNode txtnode = new TextNode("Syncfusion",new RectangleF(100,100,100,100));
//To set the text in Vertical position.
txtnode.DirectionVertical = true;
//Adjusting size of the node to fit the text.
txtnode.SizeToText(new SizeF(0, 0));
//Hiding the Boundary line of the textnode.
txtnode.LineStyle.LineWidth = 0;
Group grp = new Group();
grp.AppendChild(txtnode);
this.diagram1.Model.AppendChild(grp);

2. You can also use the container node to host the label and rotate the label to vertical by rotating the container node.Please refer the below code snippet.

Here is the code:
[C#]
//Label inside a container node.
Syncfusion.Windows.Forms.Diagram.Rectangle rect = new Syncfusion.Windows.Forms.Diagram.Rectangle(250, 100, 100, 100);
//Changing the fillcolor of the node to Transparent.
rect.FillStyle.Color = Color.Transparent;
//Hiding the Boundary line of the node.
rect.LineStyle.LineWidth = 0;
//Rotating the node in 90 degree
rect.RotationAngle = 90;
//Adding label to the container node.
rect.Labels.Add(new Syncfusion.Windows.Forms.Diagram.Label(rect, "Label inside container"));
Group grp1 = new Group();
grp1.AppendChild(rect);
diagram1.Model.AppendChild(grp1);

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.
Forum adding labels to group node-312248110.zip

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.

;