officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-b0bfa081.md
Defines the color and position of a transition point in a gradient.
Namespace : DevExpress.XtraRichEdit.API.Native
Assembly : DevExpress.RichEdit.v25.2.Core.dll
NuGet Package : DevExpress.RichEdit.Core
public struct GradientStop :
IEquatable<GradientStop>
Public Structure GradientStop
Implements IEquatable(Of GradientStop)
Pass the GradientStop instances to the following methods to apply a gradient to a shape or its border:
Shape.Fill.SetGradientFill - fills a shape with a gradient.
Shape.Line.Fill.SetGradientFill - applies a gradient to a line or a shape’s border.
The example below shows how to apply a gradient of three colors to a rectangle.
// 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 });
' Add a rectangle to a document.
Dim rectangle As Shape = document.Shapes.InsertShape(document.Range.Start, ShapeGeometryPreset.Rectangle, New RectangleF(300, 200, 500, 300))
' Apply a gradient of three colors to the rectangle.
Dim stop1 As New GradientStop(0F, Color.FromArgb(&HFE, &HD7, &H66))
Dim stop2 As New GradientStop(0.5F, Color.FromArgb(&HFF, &H33, &H77))
Dim stop3 As New GradientStop(1F, Color.FromArgb(&H2A, &H4D, &H69))
rectangle.Fill.SetGradientFill(GradientType.Shape, New GradientStop() { stop1, stop2, stop3 })
Use the GradientFill.GradientStops property to access a GradientStopCollection object that stores existing gradient stops. The collection’s methods allow you to add and delete gradient stops.
See Also