Skip to main content
.NET Framework 4.5.2+

DrawingObject.Fill Property

Allows you to specify fill options for a shape.

Namespace: DevExpress.XtraRichEdit.API.Native

Assembly: DevExpress.RichEdit.v22.1.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));

The following code snippets (auto-collected from DevExpress Examples) contain references to the Fill property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also