Hi Everyone,
I am working on a color palette project which is a bit complicated.
There is a rectangle which shows the gradient. Like this:
Now, I can select two colors and two points on the rectangle, and a new gradient needs to be added like this:
Here I selected red and green and two points like 20 and 50 (considering rectangle to be 1 to 100).
I can do this any number of times. So the rectangle can look full of gradients.
I tried to do this using LinearGradientBrush and then adding a GradientStop when user selects color and points. But its not quite the way it is suppose to be.
I have this right now:
public void GenerateGradient(Color initialColor, Color finalColor, Point point1, Point point2) { GradientStop gradientStop = new GradientStop(initialColor, point1.X/100.0); LinearGradientBrush.GradientStops.Add(gradientStop); gradientStop = new GradientStop(finalColor, point2.X / 100.0); LinearGradientBrush.GradientStops.Add(gradientStop); ColorGradientRectangle.Fill = LinearGradientBrush; }
I am sure this is no where near the right code, but this is what I am thinking right now.
Could anyone help me with this.
Thank you .
Please Mark as Answered If this answers your question OrUnMark as Answered if it did not.
Happy to Help :)
My Site