All docs
V21.1
21.2 (EAP/Beta)
21.1
20.2
20.1
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.
.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

GradientFill.FillRect Property

Specifies the gradient fill direction.

Namespace: DevExpress.XtraRichEdit.API.Native

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

Declaration

RectangleOffset FillRect { get; set; }

Property Value

Type Description
RectangleOffset

An object that specifies offsets (in percentage) from the fill rectangle edges to the center shade rectangle.

Remarks

Use the FillRect property to specify a gradient direction. It depends on the gradient type applied to a shape (GradientFill.GradientType). The FillRect property defines the position of the center shade relative to the fill rectangle.

Example 1

In the example below, the center shade occupies the entire shape except for the topmost, leftmost, and rightmost 25% of the rectangle. The gradient fills the remaining area.

Rich_GradientFill_FillRect_Example

// Add a rectangle to the document.
Shape rectangle = document.Shapes.InsertShape(document.Range.Start, ShapeGeometryPreset.Rectangle, new RectangleF(300, 200, 500, 300));
// Fill the rectangle with a gradient.
rectangle.Fill.SetGradientFill(GradientType.Rectangle, Color.FromArgb(0xF6, 0xCD, 0x61), Color.FromArgb(0xEE, 0x40, 0x35));
// Specify the gradient direction.
rectangle.Fill.GradientFill.FillRect = new RectangleOffset(0.25f, 0.25f, 0.25f, 0f);

Example 2

This example creates a rectangle with a gradient direction that starts from the bottom right corner.

Rich_GradientFill_FillRect_From_Corner

// Add a rectangle to the document.
Shape rectangle = document.Shapes.InsertShape(document.Range.Start, ShapeGeometryPreset.Rectangle, new RectangleF(300, 200, 500, 300));
// Fill the rectangle with a gradient.
rectangle.Fill.SetGradientFill(GradientType.Rectangle, Color.FromArgb(0xF6, 0xCD, 0x61), Color.FromArgb(0xEE, 0x40, 0x35));
// Specify the following gradient direction: "From Bottom Right Corner".
rectangle.Fill.GradientFill.FillRect = new RectangleOffset(1f, 1f, 0f, 0f);

Example 3

The example below creates a circle with a radial gradient direction that starts from the center. The FillRect property defines a point in the center of the shape.

Rich_GradientFill_FillRect_From_Center

// Add a circle to the document.
Shape rectangle = document.Shapes.InsertShape(document.Range.Start, ShapeGeometryPreset.Oval, new RectangleF(300, 200, 500, 500));
// Apply a three-color gradient to the circle.
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.Circle, new GradientStop[] { stop1, stop2, stop3 });
// Specify the following gradient direction: "From Center".
rectangle.Fill.GradientFill.FillRect = new RectangleOffset(0.5f, 0.5f, 0.5f, 0.5f);
See Also