Skip to main content
Box

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

PageCanvas.DrawImage(OfficeImage, Rectangle, ImageSizeMode) Method

Draws a custom image.

Namespace: DevExpress.XtraRichEdit.API.Layout

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

NuGet Package: DevExpress.RichEdit.Core

#Declaration

public void DrawImage(
    OfficeImage image,
    Rectangle bounds,
    ImageSizeMode sizeMode
)

#Parameters

Name Type Description
image OfficeImage

The OfficeImage object that will be placed at the selected position.

bounds Rectangle

Sets the location and size of the image.

sizeMode ImageSizeMode

Specifies the image position within the stated bounds.

#Example

This code snippet illustrates the implementation of the PageCanvas.DrawImage and PageCanvas.FillEllipse methods. They draw a filled color ellipse and a custom image over the table cell.

View Example

Public Overrides Sub DrawTableCell(ByVal tableCell As LayoutTableCell)
    If Form1.customDrawTable = True Then
        Dim Tbounds As Rectangle = tableCell.Bounds
        Dim tableRectangle As New Rectangle(New Point(Tbounds.X + Tbounds.Width \ 2 - 10, Tbounds.Y + Tbounds.Height \ 2 - 10), New Size(20, 20))
        Canvas.FillEllipse(New RichEditBrush(Color.MediumAquamarine), Canvas.ConvertToDrawingLayoutUnits(tableRectangle, DocumentLayoutUnit.Pixel))
        Canvas.DrawImage(OfficeImage.CreateImage(DevExpress.Images.ImageResourceCache.Default.GetImage("devav/people/employeeaward_16x16.png")), tableCell.Bounds, ImageSizeMode.Squeeze)
        MyBase.DrawTableCell(tableCell)
    Else
        MyBase.DrawTableCell(tableCell)
    End If
End Sub
See Also