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.
Syncfusion Feedback

how to Apply Costom Color to Label

Thread ID:

Created:

Updated:

Platform:

Replies:

104273 Jul 5,2012 03:18 PM UTC Jul 11,2012 12:02 PM UTC Windows Forms 3
loading
Tags: Diagram
prashanthi
Asked On July 5, 2012 03:18 PM UTC

Dear Sir/Madam,

I have the requirement to apply different color to label[Syncfusion.Diagram.Label],
But Unfortunately Fill Color or Fore Color[Any thing that related to Color] is not available for that label,

Can you please tell me How do I Clear this error and Apply the color to The label?

Please find the attached Screen Shots of Label Coloring Error.

Can u please help on this.

Thanks in Advance,
Prashanthi.


Error in Applying COlor to Label_19b7cdb6.rar

Amsath Ali M [Syncfusion]
Replied On July 6, 2012 01:07 PM UTC

Hi Prasanthi,

 

Thanks for your interest in Syncfusion products.

 

We suggest you to use the ‘FillStyle’ class to apply color for the Label’s text. Please refer the below code snippet to achieve your requirement.

 

Here is the code:

[C#]

CustomLabel.cs:

public class CustomLabel:Label

    {

        private PointF m_refLocn;

        private FillStyle m_styleFill;

        public CustomLabel()

            : base()

        {

 

        }

 

        public CustomLabel(CustomLabel src)

            : base(src)

        {

            if (src.m_styleFill != null)

                m_styleFill = (FillStyle)src.m_styleFill.Clone();

        }

 

        public CustomLabel(Node container, string strText)

            : base(container, strText)

        {

 

        }

 

        public FillStyle FontColor

        {

            get

            {

                if (m_styleFill == null)

                {

                    m_styleFill = new FillStyle();

                    m_styleFill.Color = Color.Black;

                }

 

                return m_styleFill;

            }

        }

        protected CustomLabel(SerializationInfo info, StreamingContext context)

            : base(info, context)

        {

            foreach (SerializationEntry entry in info)

            {

                switch (entry.Name)

                {

                    case "fillStyle":

                        m_styleFill = (FillStyle)info.GetValue("fillStyle", typeof(FillStyle));

                        break;

                }

            }

           

        }

 

      

      

        protected override void Render(Graphics gfx)

        {

            this.FontColorStyle.Color = this.FontColor.Color;

            base.Render(gfx);            

        }

 

       

    }

 

Here is the sample:

F104273.zip

 

Please let us know if you have any queries.

 

Regards,

Amsath Ali. M



F104273_e95afad4.zip

prashanthi
Replied On July 9, 2012 10:45 AM UTC

Hi Amsath Ali,

Thanks for the reply,

I have tried coloring Label[Syncfusion.Diagram] text as suggested by you,but its not working its asking for the Object "FontColorStyle" from the below code,

protected override void Render(Graphics gfx)

        {

            this.FontColorStyle.Color = this.FontColor.Color;

            base.Render(gfx);            

        }

i don't have this object in my file ,

The version i am working for this is VS2010 and Syncfusion 6.0

Can you please tell me How do I get this " FontColorStyle" object and Apply the color to The label?

Please find the attached Screen Shot of Label Coloring Issue.

Can u please help on this.

Thanks in Advance,
Prashanthi.



Unable to Find FontColorStyle Object_8c9cb09c.rar

Amsath Ali M [Syncfusion]
Replied On July 11, 2012 12:02 PM UTC

Hi Prashanthi,

 

Thanks for your update.

 

Since the Version [6.0] does not contain support to change the color of the Node’s Label, could you please upgrade to our latest version [10.2.0.75], because the latest version has many features related to labels like ‘Label Color, Text wrap, string alignment, etc.?

 

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.

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

;