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.

Rotated Label

Thread ID:

Created:

Updated:

Platform:

Replies:

90872 Oct 22,2009 09:47 AM Mar 17,2018 05:48 AM Windows Forms 4
loading
Tags: Tools
FRANCISCO BARREDO
Asked On October 22, 2009 09:47 AM

Hi,

I'm sort of new working with the SyncFusion controls and I found myself looking for some special control (maybe it already existes and I haven's found it yet). I was looking for a Label control (just like the normal one) with a particular property: Angle. Depending on the value given for angle the text for the label is written rotated (as an example I attached something seen in the Grid control).

Does that kind of control already exist? If so, where can I find it?

Thanks in advance



RotatedLabel_de1378cd.zip

Mano J [Syncfusion]
Replied On October 23, 2009 12:19 AM

Hi Francisco,

We don't have a label with rotating ability. But you can derive a RotatingLabel from Syncfusion's AutoLabel control as shown below

public class RotatingLabel : AutoLabel
{
private int angle = 0;
public RotatingLabel()
{
}

public int Angle
{
get { return angle; }
set
{
angle = value;
this.Invalidate();
}
}

protected override void OnPaint(PaintEventArgs e)
{
if (angle > 0)
{
StringFormat string_format = new StringFormat();
string_format.Alignment = StringAlignment.Center;
string_format.LineAlignment = StringAlignment.Center;
e.Graphics.RotateTransform(angle);
e.Graphics.TranslateTransform(this.ClientSize.Width / 2, this.ClientSize.Height / 2, System.Drawing.Drawing2D.MatrixOrder.Append);
SolidBrush brush = new SolidBrush(this.ForeColor);
e.Graphics.DrawString(this.Text, this.Font, brush, 0, 0, string_format);
}
else
base.OnPaint(e);
}
}

Regards,
Mano

FRANCISCO BARREDO
Replied On October 26, 2009 04:56 AM

Thanks

Mano J [Syncfusion]
Replied On October 27, 2009 05:40 AM

Hi Francisco,

Thanks for the update.

Regards,
Mano

urvish
Replied On March 17, 2018 05:48 AM

Hi Francisco,

Thanks for the update.

Regards,
Mano

you can do it by using math calss.

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.

;