Skip to main content

ShapeFill.SetGradientFill(GradientType, IEnumerable<GradientStop>) Method

Applies a complex gradient to a shape.

Namespace: DevExpress.XtraRichEdit.API.Native

Assembly: DevExpress.RichEdit.v24.1.Core.dll

NuGet Packages: DevExpress.RichEdit.Core, DevExpress.Win.Navigation

Declaration

void SetGradientFill(
    GradientType gradientType,
    IEnumerable<GradientStop> gradientStops
)

Parameters

Name Type Description
gradientType GradientType

An enumeration member that specifies the gradient type.

gradientStops IEnumerable<GradientStop>

A list of objects that contain information about gradient stops.

Remarks

The example below shows how to apply a gradient of three colors to a rectangle.

Rich_ShapeFill_GradientFill_Complex

// Add a rectangle to a document.
Shape rectangle = document.Shapes.InsertShape(document.Range.Start, ShapeGeometryPreset.Rectangle, new RectangleF(300, 200, 500, 300));
// Apply a gradient of three colors to the rectangle.
GradientStop stop1 = new GradientStop(0f, Color.FromArgb(0xFE, 0xD7, 0x66));
GradientStop stop2 = new GradientStop(0.5f, Color.FromArgb(0xFF, 0x33, 0x77));
GradientStop stop3 = new GradientStop(1f, Color.FromArgb(0x2A, 0x4D, 0x69));
rectangle.Fill.SetGradientFill(GradientType.Shape, new GradientStop[] { stop1, stop2, stop3 });

Use the ShapeFill.GradientFill property to adjust existing gradient settings or add more gradient stops.

See Also