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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Gradient Colors to be obsoleted?

Thread ID:

Created:

Updated:

Platform:

Replies:

48276 Aug 23,2006 09:26 PM UTC Aug 31,2006 11:06 PM UTC General Discussion 7
loading
Tags: General Discussion
Robert Maxey
Asked On August 23, 2006 09:26 PM UTC

I am working throught the source code and there is an obsolete flag on the GradientColors property of the Gradient Panel. It says this property is to be removed in the future.

Is there another way to create multicolor gradients? Meaning gradients with more than 2 colors.

Thanks,

Bob

Anupama Roy [Syncfusion]
Replied On August 24, 2006 11:16 AM UTC


Hi Bob,

You can use the BackgroundColor inorder to get multiple colors

Code:

this.gradientPanel1.BackgroundColor = new Syncfusion.Drawing.BrushInfo(Syncfusion.Drawing.GradientStyle.Horizontal, new System.Drawing.Color[] {
System.Drawing.SystemColors.Info,System.Drawing.Color.Magenta,System.Drawing.Color.Aqua});

Please let me know if you have any difficulties.

Thanks for choosing Syncfusion products.

Regards,

Anu.

Anupama Roy [Syncfusion]
Replied On August 24, 2006 11:28 AM UTC

Hi Bob,

Please take a look this screenshot also.

Screenshot

Thanks,

Anu.


Robert Maxey
Replied On August 24, 2006 06:11 PM UTC



>Hi Bob,

Please take a look this screenshot also.

Screenshot

Thanks,

Anu.


Anu,

This property that you point out on the screen shot is the property that is marked obsolete in the source code.

Using backcolor only gives two color gradients. There is a property in the LinearGradientBrush called InterpolationColors that allows gradients with more than two colors. I am wondering how I can supply InterpolationColors to the Gradient Panel.

But again, the code says that the property is to be obsoleted. That is why I am concerned.

Thanks.

Bob

Anupama Roy [Syncfusion]
Replied On August 25, 2006 05:37 AM UTC


Hi Bob,

This Screenshot is taken with our current version 4.2.Could you please let us know the version of Essential Studio you are working with,so that I can provide you an accurate solution.

Thanks,

Anu.

Robert Maxey
Replied On August 25, 2006 06:45 PM UTC



>
Hi Bob,

This Screenshot is taken with our current version 4.2.Could you please let us know the version of Essential Studio you are working with,so that I can provide you an accurate solution.

Thanks,

Anu.

I am working in 4.2. And I do see that the Gradient Colors are there. But when I look at the source code:


///
/// Gets / sets the color array that defines the gradient.
///

///
/// This property will be removed in the future. Please use the BackgroundColor property instead.
///

[Browsable(false),
Obsolete("This property will be removed in the future. Please use the BackgroundColor property instead."),
DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public Color[] GradientColors
{
get{return (Color[])(this.BackgroundColor.GradientColors.ToArray(typeof(Color)));}
set
{
BrushInfo bi = this.BackgroundColor;

if(bi.Style == BrushStyle.Gradient)
{
this.BackgroundColor = new BrushInfo(bi.GradientStyle, new BrushInfoColorArrayList(value));
}
else if(bi.Style == BrushStyle.Pattern)
{
this.BackgroundColor = new BrushInfo(bi.PatternStyle, new BrushInfoColorArrayList(value));
}
else if(value.Length > 0)
{
this.BackgroundColor = new BrushInfo(GradientStyle.Vertical, new BrushInfoColorArrayList(value));
}
}
}


It says that the property is to be obsoleted. There are instructions to not use this function. Note the Obsolete attribute in the code above.

Bob

Anupama Roy [Syncfusion]
Replied On August 31, 2006 04:57 AM UTC

Hi Bob,

Sorry for the delay.I had gone for a vecation and could not get back to you immediately.

If you closely observe,you can see that there is one property gradientPanel1.GradientColors and this obsolete attribute in the code above says that you should not use this property GradientColors directly.The property I had marked in the screenshot is BackgroundColor and within this property,the above mentioned GradientColors array will be passed and you can get the desired Gradient or Pattern behaviour.There is no harm in using BackgroundColor property and this will not be removed from our source code.

Please let me know if you have any other queries.

Thanks for your patience.

Best Regards,

Anu.


Robert Maxey
Replied On August 31, 2006 11:06 PM UTC

Anu,

I understand how I can use forecolor and backcolor to make a gradient with 2 colors in it. But that gradient colors (called interpolation colors in the LinearGradientBrush) property allows more than 2 colors. You also have more control in the way gradient colors appear.

Check out the ColorBlend object is the .NET framework.

I can get by for now with 2 colors, but I would hope that future updates of your product will allow me to have gradients with more than 2 colors in them. That is why I am so concerned about obsoleting that property. It seems to be progress in the wrong direction.

Maybe I''ll need to write my own?

Thanks!

Bob

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

;