GradientFill Class
Gradient fill.
Namespace: DevExpress.Docs.Presentation
Assembly: DevExpress.Docs.Presentation.v25.2.dll
NuGet Package: DevExpress.Docs.Presentation
Declaration
Related API Members
The following members return GradientFill objects:
Remarks
The following example applies a linear gradient fill to the presentation slide background:
using DevExpress.Docs.Presentation;
using DevExpress.Drawing;
using System.Drawing;
Slide slide = new Slide(new SlideLayout(layoutType: SlideLayoutType.Blank, name: "slide"));
GradientFill fill = new GradientFill(gradientType: GradientType.Linear);
fill.GradientStops.Add(new GradientStop(Color.Cornsilk, 10));
fill.GradientStops.Add(new GradientStop (Color.AliceBlue, 30));
fill.GradientStops.Add(new GradientStop (Color.RoyalBlue, 90));
slide.Background = new CustomSlideBackground(fill);
The following example applies a gradient fill to a shape:
using DevExpress.Docs;
using DevExpress.Docs.Presentation;
using System.Drawing;
namespace PresentationApiSample;
public class Program {
public static async Task Main(string[] _) {
//...
Shape shape1 = new Shape(ShapeType.Rectangle);
shape1.Outline = new LineStyle { Fill = new SolidFill(Color.RoyalBlue), Width = 8 };
shape1.X = 1100;
shape1.Y = 1100;
shape1.Width = 300;
shape1.Height = 300;
slide.Shapes.Add(shape1);
GradientFill fill = new GradientFill(gradientType: GradientType.Linear);
fill.GradientStops.Add(new GradientStop(Color.Cornsilk, 10));
fill.GradientStops.Add(new GradientStop (Color.AliceBlue,50));
fill.GradientStops.Add(new GradientStop (Color.RoyalBlue, 90));
fill.Scaled = true;
shape1.Fill = fill;
}
}
Implements
Inheritance
Object
PresentationObject
Fill
OutlineFill
GradientFill
See Also