PageCanvas Class
Encapsulates the layout drawing surface.
Namespace: DevExpress.XtraRichEdit.API.Layout
Assembly: DevExpress.RichEdit.v19.1.Core.dll
Declaration
Remarks
The PageCanvas class provides methods for drawing objects in the document layout.
Use the PagePainter.Canvas property to obtain the PageCanvas object in overridden methods of the PagePainter descendant.
Use the BeforePagePaintEventArgs.Canvas property to access the PageCanvas object and perform a custom draw in the BeforePagePaint event handler.
The PageCanvas enables you to draw lines and shapes, with the specific Draw_GraphicalElement_ method. You can also draw images with the PageCanvas.DrawImage method and text with the PageCanvas.DrawString method.
For complex drawings, you may need to convert the document units of measurement to the units used in layout drawings. The PageCanvas.ConvertToDrawingLayoutUnits method is implemented to accomplish this task.
Example
This code snippet illustrates the implementation of a PagePainter descendant. It draws color rectangles in place of the words and labels a floating picture with a text string drawn over it.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/layout-api-simple-example-t245818
Public Class MyLayoutPainter
Inherits PagePainter