<< Click to display table of contents >>


Allows to perform custom drawing of a text item of the StyleNo-th text style.

property OnDrawStyleText: TRVDrawStyleTextEvent



  TRVDrawStyleTextEvent = procedure (Sender: TRVStyle;
    const s: TRVUnicodeString; Canvas: TCanvas; StyleNo: Integer;
    SpaceAtLeft, Left, Top, Width, Height
    TextWidth, SpaceCount: Integer;
    DrawState: TRVTextDrawStates;
    Printing, PreviewCorrection, ForMetafile: Boolean;
    ColorMode: TRVColorMode; DefBiDiMode: TRVBiDiMode;
    RefCanvas: TCanvas;
    LeftNoExpIndex, RightNoExpIndex: Integer;

    PSaD: PRVScreenAndDevice
    var DoDefault: Boolean) of object;

(introduced in version 1.3; new states in TRVTextDrawStates since 1.4; changed in v16 and v18)

You can use this event to modify drawing of text of some or all text styles.

Input parameters:

The same is in TFontInfo.Draw. You can call Sender.TextStyles[StyleNo].Draw(..) passing the even parameters.

"Hidden" input parameters:

Sender.RVData: TPersistent, document containing this paragraph. It should be typecasted to TCustomRVFormattedData before using.

Sender.ItemNo: Integer, index of the item in Sender.RVData.

Self.OffsetInItem: Integer, index of the first character in the item to draw.

These parameters allow to get additional information about the item being painted.

For example:

uses ..., CRVFData;


var ItemTag: TRVTag;


ItemTag := TCustomRVFormattedData(Sender.RVData).GetItemTag(Sender.ItemNo));


Output parameters:

DoDefault – set to False to prevent default drawing.


See also events:




See also properties:


Demo projects:

Demos\*\Assorted\Custom Draw\