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.PictureFill Property

Provides access to picture fill settings.

Namespace: DevExpress.XtraRichEdit.API.Native

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

NuGet Package: DevExpress.RichEdit.Core

#Declaration

PictureFill PictureFill { get; }

#Property Value

Type Description
PictureFill

An object that stores picture fill settings.

#Remarks

#Picture Fill

Call the Shape.Fill.SetPictureFill method to fill a shape with a picture. Use the Shape.Fill.PictureFill.FillRect property to specify which part of the shape the picture should occupy.

The example below shows how to fill the entire rectangle with a picture except for the top and bottom 10%.

Rich_PictureFill_FillRect

// Create a rectangle.
Shape rectangle = document.Shapes.InsertShape(document.Range.Start, ShapeGeometryPreset.Rectangle, new RectangleF(300, 200, 480, 400));
// Use a picture to fill the rectangle.
rectangle.Fill.SetPictureFill(DocumentImageSource.FromFile("PictureFill_Dog.png"));
// Specify which part of the rectangle the picture should occupy.
rectangle.Fill.PictureFill.FillRect = new RectangleOffset(0f, 0.1f, 0f, 0.1f);

#Texture Fill

Set the Shape.Fill.PictureFill.Stretch property to false to tile the shape with a picture as shown below.

Rich_TextureFill

// 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(DocumentImageSource.FromFile("PictureFill_Leaf.png"));
// Access picture fill settings.
PictureFill pictureFill = rectangle.Fill.PictureFill;
// Tile the picture as texture.
pictureFill.Stretch = false;
// Scale the picture to 50% of its original size.
pictureFill.ScaleX = 0.5f;
pictureFill.ScaleY = 0.5f;
// Specify the first tile position.
pictureFill.TileAlign = TileAlignType.TopLeft;
// Specify the mirror type for tiles.
pictureFill.TileFlip = TileFlipType.Vertical;
See Also