officefileapi-devexpress-dot-docs-dot-presentation-f7da6e93.md
Gradient fill.
Namespace : DevExpress.Docs.Presentation
Assembly : DevExpress.Docs.Presentation.v25.2.dll
NuGet Package : DevExpress.Docs.Presentation
public class GradientFill :
OutlineFill
Public Class GradientFill
Inherits OutlineFill
The following members return GradientFill objects:
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);
Imports DevExpress.Docs.Presentation
Imports DevExpress.Drawing
Imports System.Drawing
Dim slide As New Slide(New SlideLayout(SlideLayoutType.Blank, "slide"))
Dim fill As New GradientFill(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;
}
}
Imports DevExpress.Docs
Imports DevExpress.Docs.Presentation
Imports System.Drawing
Namespace PresentationApiSample
Public Class Program
Public Shared Async Function Main(__ As String()) As Task
Dim shape1 As New Shape(ShapeType.Rectangle)
shape1.Outline = New LineStyle With {.Fill = New SolidFill(Color.RoyalBlue), .Width = 8}
shape1.X = 1100
shape1.Y = 1100
shape1.Width = 300
shape1.Height = 300
slide.Shapes.Add(shape1)
Dim fill As New GradientFill(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
End Function
End Class
End Namespace
Object PresentationObject Fill OutlineFill GradientFill
See Also