TCustomRichView.DocumentPixelsPerInch [VCL, LCL]

<< Click to display table of contents >>

TCustomRichView.DocumentPixelsPerInch [VCL, LCL]

Allows overriding a 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.

Zooming

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.

After changing value of this property, call Format or Reformat.

Zooming is applied to almost everything: margins, background images, items in a document. However, there are exceptions; the following items are not affected:

controls

images from image lists (bullets and hot-spots)*

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).

RichViewActions note

If you use TRVRuler from RichViewActions, after changing a value of DocumentPixelsPerInch, you need to change the ruler's Zoom accordingly:

  RVRuler1.Zoom := 

    Round(100 * 

      RichViewEdit1.GetRealDocumentPixelsPerInch / 

      RVRuler1.ScreenRes);

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.

srv_icon ScaleRichView note

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.

 

Default value:

0

See also:

TRVStyle.UnitsPixelsPerInch

ZoomPercent (FireMonkey analog)