Vertical Gradient

Vertical Gradient

Forum member · Oct 27, 2007
how can create a gradient vertical color ? horizontal gradient color work fine but i'm not able to create a vertical gradient or oblique gradient. thanks Ivan

Re: Vertical Gradient

Support · Oct 29, 2007
Hello Ivan, Yes, you can create a vertical gradient color without any problem. You can do this by setting the x1, y1, and x2, y2 for the gradient color constructor. Following is some example which sets the vertical gradient colors. Document document = new Document(); Page page = new Page(); Rectangle rectangle = new Rectangle(0, 0, 100, 100); Gradient grColor = new Gradient(50, 0, 50, 100, RgbColor.Red, RgbColor.Blue); rectangle.FillColor = gr; page.Elements.Add(rectangle); document.Pages.Add(page); document.DrawToWeb(); Thanks, ceTe Software Support Team.

Re: Vertical Gradient

Forum member · Oct 29, 2007
cannot resolve my problem when use a transformation group. this is my code : Document document = new Document(); Page page = new Page(); TransformationGroup group = new TransformationGroup(300, 300, 150, 150); Rectangle rectangle = new Rectangle(0, 0, 100, 100); group.Add(rectangle); Gradient grColor = new Gradient(50, 0, 50, 100, RgbColor.Red, RgbColor.Blue); //Gradient grColor = new Gradient(350, 150, 350, 300, RgbColor.Red, RgbColor.Blue); rectangle.FillColor = grColor; page.Elements.Add(group); document.Pages.Add(page); document.Draw(@"c:\test.pdf"); rectangle was renderize in red. thanks Ivan

Re: Vertical Gradient

Support · Oct 29, 2007
Hello Ivan, It looks like a bug with applying the gradient effect to any page elements that are added to the transformation group. The work around to this for the time being is to set the values as below and it will show the desired gradient effect for the rectangle: TransformationGroup group = new TransformationGroup(300, 300, 150, 150); Rectangle rectangle = new Rectangle(0, 0, 100, 100); Gradient grColor = new Gradient(0, -300, 0, -200, RgbColor.Red, RgbColor.Blue); rectangle.FillColor = grColor; I will post a message on this thread as soon as we have this resolved. Thanks, ceTe Software Support Team

Re: Vertical Gradient

Forum member · Oct 30, 2007
Thanks Ivan