officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-43a1a790.md
Contains fill settings for a shape.
Namespace : DevExpress.XtraRichEdit.API.Native
Assembly : DevExpress.RichEdit.v25.2.Core.dll
NuGet Package : DevExpress.RichEdit.Core
public interface ShapeFill
Public Interface ShapeFill
The following members return ShapeFill objects:
Use the ShapeFill object’s members to specify shape fill options.
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.
// 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();
' Add a rectangle to a document.
Dim rectangle As Shape = document.Shapes.InsertShape(document.Range.Start, ShapeGeometryPreset.Rectangle, New RectangleF(300, 200, 500, 300))
' Remove a color from the rectangle.
rectangle.Fill.SetNoFill()
Use the Shape.Fill.SetSolidFill method to apply a color to a shape.
// 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));
' Add a rectangle to a document.
Dim rectangle As Shape = document.Shapes.InsertShape(document.Range.Start, ShapeGeometryPreset.Rectangle, New RectangleF(300, 200, 500, 300))
' Fill the rectangle with color.
rectangle.Fill.SetSolidFill(Color.FromArgb(&HFF, &HEE, &HAD))
Use the Shape.Fill.SetGradientFill method to fill a shape with a gradient of two or more colors.
// 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));
' 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 two-color gradient to the rectangle.
rectangle.Fill.SetGradientFill(GradientType.Rectangle, Color.FromArgb(&HFF, &H8B, &H94), Color.FromArgb(&H4D, &H64, &H8D))
Use the Shape.Fill.SetPictureFill method to fill a shape with a picture.
// 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"));
' Create a rectangle.
Dim rectangle As Shape = 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"))
Use the Shape.Fill.SetPatternFill method to fill a shape with a pattern.
// 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));
' 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 pattern to the rectangle.
rectangle.Fill.SetPatternFill(PatternFillType.SolidDiamond, Color.FromArgb(&H4D, &H64, &H8D), Color.FromArgb(&HFF, &HEE, &HAD))
See Also