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.

Shadowed Label

Thread ID:

Created:

Updated:

Platform:

Replies:

89990 Sep 13,2009 04:50 AM Sep 14,2009 05:10 AM Windows Forms 5
loading
Tags: Tools
Allon
Asked On September 13, 2009 04:50 AM

Hi, everyone

I'd like to know how to make label's text - shadowed.

Thanks in advance ;-)
Allon

Mano J [Syncfusion]
Replied On September 14, 2009 12:53 AM

Hi Allon,

You can handle label's paint event and draw the string.

private void label1_Paint(object sender, PaintEventArgs e)
{
e.Graphics.DrawString(label1.Text, label1.Font, new SolidBrush(Color.Gray), 1, 1);
e.Graphics.DrawString(label1.Text, label1.Font, new SolidBrush(label1.ForeColor), 0, 0);
}

Regards,
Mano

Allon
Replied On September 14, 2009 02:17 AM

Hi, Mano

Thanks for your example. It works perfect.

I'd like to know how to do the same thing, without changing the location of the Label1.Text (when the Label1.Text is in the middle of the label, for example). I hope It's something simple and it's not depending on calculations depend on Label1.Text location. If it is the only way to do it, then it will be very helpful to know the location of the Label1.Text within the label control.

Thanks in advance :)
Allon

Nandakumar R [Syncfusion]
Replied On September 14, 2009 03:14 AM

Hi Allon,

Please refer to the MyLabel class implementation in the Form1 in the attached sample. With this you can give Shadow Text to your label at any alignment.

Please change the ShadowColor property of the class to change the shadow color in rendering.

http://www.syncfusion.com/uploads/redirect.aspx?file=ShadowLabel_1f92e198.zip&team=support

Regards,
Nanda

Allon
Replied On September 14, 2009 05:09 AM

Nanda, thanks a lot. It works absolutely fine.

Regards,
Allon

Nandakumar R [Syncfusion]
Replied On September 14, 2009 05:10 AM

Hi Allon,

Thanks for the update.

Regards,
Nanda

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.

;