Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

ShapeFill.SetGradientFill(GradientType, Color, Color) Method

Applies a two-color gradient to a shape.

Namespace: DevExpress.XtraRichEdit.API.Native

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

NuGet Package: DevExpress.RichEdit.Core

#Declaration

void SetGradientFill(
    GradientType gradientType,
    Color color1,
    Color color2
)

#Parameters

Name Type Description
gradientType GradientType

An enumeration member that specifies the gradient type.

color1 Color

A color at the start point (0).

color2 Color

A color at the end point (1).

#Remarks

The example below shows how to apply a gradient to a rectangle.

Rich_ShapeFill_GradientFill_Simple

// Add a rectangle to a document.
Shape rectangle = document.Shapes.InsertShape(document.Range.Start, ShapeGeometryPreset.Rectangle, new RectangleF(300, 200, 500, 300));
// Apply a two-color gradient to the rectangle.
rectangle.Fill.SetGradientFill(GradientType.Rectangle, Color.FromArgb(0xFF, 0x8B, 0x94), Color.FromArgb(0x4D, 0x64, 0x8D));

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

See Also