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

LineFillFormat.GradientFill Property

Provides access to gradient fill settings.

Namespace: DevExpress.XtraRichEdit.API.Native

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

NuGet Package: DevExpress.RichEdit.Core

#Declaration

GradientFill GradientFill { get; }

#Property Value

Type Description
GradientFill

An object that stores gradient fill settings.

#Remarks

Call the Shape.Line.Fill.SetGradientFill method to apply a gradient of two or more colors to a line or a shape’s border. The GradientFill property allows you to access and change the applied gradient:

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

Rich_ShapeLine_ComplexGradientFill

// Create a rectangle.
Shape rectangle = document.Shapes.InsertShape(document.Range.Start, ShapeGeometryPreset.Rectangle, new RectangleF(300, 200, 500, 300));
rectangle.Fill.SetNoFill();
// Format the rectangle's outline.
ShapeLine border = rectangle.Line;
// Apply a linear gradient to the outline.
border.Fill.SetGradientFill(GradientType.Linear, Color.FromArgb(0x1B, 0x98, 0xE0), Color.FromArgb(0xFF, 0x16, 0x54));
// Access gradient fill settings.
GradientFill gradientFill = border.Fill.GradientFill;
// Add another gradient stop.
gradientFill.GradientStops.Add(new GradientStop(0.5f, Color.FromArgb(0xF3, 0xFF, 0xBD)));
// Specify the gradient angle.
gradientFill.Angle = 30;
// Set the line width.
border.Thickness = 6;
See Also