All docs
V20.2
21.1 (EAP/Beta)
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+

DrawingObject.Fill Property

Allows you to specify fill options for a shape.

Namespace: DevExpress.XtraRichEdit.API.Native

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

Declaration

ShapeFill Fill { get; }

Property Value

Type Description
ShapeFill

An object that contains shape fill settings.

Remarks

Use the Fill property to access fill settings that allow you to customize a shape's appearance.

No Fill

Use the Shape.Fill.SetNoFill method to remove a fill from a shape.

The example below shows how to use the SetNoFill method to create a transparent rectangle.

Rich_ShapeFill_NoFill

// Add a rectangle to a document.
Shape rectangle = document.Shapes.InsertShape(document.Range.Start, ShapeGeometryPreset.Rectangle, new RectangleF(300, 200, 500, 300));
// Remove a color from the rectangle.
rectangle.Fill.SetNoFill();

Solid Fill

Use the Shape.Fill.SetSolidFill method to apply a color to a shape.

Rich_ShapeFill_SolidFill

// Add a rectangle to a document.
Shape rectangle = document.Shapes.InsertShape(document.Range.Start, ShapeGeometryPreset.Rectangle, new RectangleF(300, 200, 500, 300));
// Fill the rectangle with color.
rectangle.Fill.SetSolidFill(Color.FromArgb(0xFF, 0xEE, 0xAD));

Gradient Fill

Use the Shape.Fill.SetGradientFill method to fill a shape with a gradient of two or more colors.

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));

Picture Fill

Use the Shape.Fill.SetPictureFill method to fill a shape with a picture.

Rich_ShapeFill_PictureFill

// Create a rectangle.
Shape rectangle = document.Shapes.InsertShape(document.Range.Start, ShapeGeometryPreset.Rectangle, new RectangleF(300, 200, 500, 350));
// Use a picture to fill the rectangle.
rectangle.Fill.SetPictureFill(System.Drawing.Image.FromFile("PictureFill_Dog.png"));

Pattern Fill

Use the Shape.Fill.SetPatternFill method to fill a shape with a pattern.

Rich_ShapeFill_PatternFill

// Add a rectangle to a document.
Shape rectangle = document.Shapes.InsertShape(document.Range.Start, ShapeGeometryPreset.Rectangle, new RectangleF(300, 200, 500, 300));
// Apply a pattern to the rectangle.
rectangle.Fill.SetPatternFill(PatternFillType.SolidDiamond, Color.FromArgb(0x4D, 0x64, 0x8D), Color.FromArgb(0xFF, 0xEE, 0xAD));
See Also