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

ShapeFill Interface

Contains fill settings for a shape.

Namespace: DevExpress.XtraRichEdit.API.Native

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

NuGet Package: DevExpress.RichEdit.Core

#Declaration

public interface ShapeFill

The following members return ShapeFill objects:

#Remarks

Use the ShapeFill object’s members to specify shape fill options.

#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