All docs
V21.1
21.2 (EAP/Beta)
21.1
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+

PictureFormat.SetPicture(DocumentImageSource) Method

Allows you to replace the current picture.

Namespace: DevExpress.XtraRichEdit.API.Native

Assembly: DevExpress.RichEdit.v21.1.Core.dll

Declaration

void SetPicture(
    DocumentImageSource imageSource
)

Parameters

Name Type Description
imageSource DocumentImageSource

An object that specifies the image source.

Remarks

The SetPicture method allows you to replace an existing picture with another picture and maintain the original picture’s format, size, and position.

Rich_PictureFormat_SetPicture

Document document = wordProcessor.Document;
// Set the measurement unit to inches.
document.Unit = DevExpress.Office.DocumentUnit.Inch;
// Insert a picture.
Shape picture = document.Shapes.InsertPicture(document.Range.Start, DocumentImageSource.FromFile("Picture_Dog.png"));
// Set the picture size.
picture.Size = new SizeF(3f, 2.5f);
// Align the picture.
picture.HorizontalAlignment = ShapeHorizontalAlignment.Center;
picture.VerticalAlignment = ShapeVerticalAlignment.Top;
// Change the picture's form.
picture.PictureFormat.Preset = ShapeGeometryPreset.RoundedRectangle;
// Display a border around the picture.
picture.Line.Color = Color.Black;
// Replace the picture.
picture.PictureFormat.SetPicture(DocumentImageSource.FromFile("Picture_Cat.png"));
See Also