rvico TRichView Reference | TRVStyle


Top  Previous  Next

Occurs when drawing background of text of the StyleNo-th text style.

property OnDrawTextBack: TRVDrawTextBackEvent;



  TRVDrawTextBackEvent =

    procedure (Sender: TRVStyle; Canvas: TCanvas;

      StyleNo: Integer; Left, Top, Width, Height: Integer;

      DrawState: TRVTextDrawStates;

      var DoDefault: Boolean) of object;

(introduced in version 1.3)

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

Unlike OnDrawStyleText, this event is called only once for each drawing item (OnDrawStyleText can be called several times if part of text item is selected). In paragraphs having Alignment=rvaJustify, each word is a drawing item, but OnDrawTextBack is called only once per line, covering all area below this text item.

Input parameters:

Sender – TRVStyle generating the event.

Canvas – canvas to paint.

StyleNo – index of text style in TextStyles collection.

Left, Top, Width, Height – rectangle where to paint.

DrawState may include rvtsControlFocused and rvtsHover, see , see TRVTextDrawStates.

DoDefault is equal to True.


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

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. It is supported only if TextBackgroundKind<>rvtbkSimple.


See also events:




See also properties:


Demo projects:

Demos\Delphi\Assorted\Custom Draw\

Demos\CBuilder\Assorted\Custom Draw\

TRichView © trichview.com