Allows overriding pixel depth for drawing documents in this control (“pixel depth” is a count of logical pixels in one inch, also known as DPI or PPI)
property DocumentPixelsPerInch: Integer;
(introduced in version 18)
The actual pixel depth that used to render documents is returned by GetRealDocumentPixelsPerInch method.
DocumentPixelsPerInch allows to implement zooming. For example, if the screen (or the current monitor) DPI = 96, you can assign DocumentPixelsPerInch = 192 to apply 200% zoom.
This zooming affects only displaying in TRichView. It does not affect printing, exporting and importing to files.
Zooming is applied to almost everything: margins, background images, items in a document. However, there are exceptions; the following items are not affected:
You need to scale controls yourself, and assign different image lists.
* in Lazarus 2+, images from image lists are scaled as well (by choosing the proper image for the given DPI, or by scaling existing images of an image for this DPI is not included in TImageList).
If you use TRVRuler from RichViewActions, after changing a value of DocumentPixelsPerInch, you need to change the ruler's Zoom accordingly:
If your application supports "per monitor v2", and if you changed DocumentPixelsPerInch, you need to recalculate the ruler's Zoom in the form's OnAfterMonitorDpiChanged event.
There is an important difference between this type of zooming, and zooming in ScaleRichView.
In TRichView, when you change DocumentPixelsPerInch value, documents are rendered in different DPI, providing ideal results for this specific DPI. However, zooming is not exactly proportional (text width in DPI = 192 may not be exactly twice larger than text width in DPI = 96).
In ScaleRichView, documents are rendered in high DPI, and then are drawn on a screen or a printer, proportionally scaled. ScaleRichView may not provide ideal character positioning, but everything is scaled proportionally, allowing WYSIWYG implementation.