rvico TRichView Reference | TRVStyle

TRVStyle.OnDrawStyleText

Top  Previous  Next

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

property OnDrawStyleText: TRVDrawStyleTextEvent

 

type

  TRVDrawStyleTextEvent =

    procedure (Sender: TRVStyle; const s: TRVRawByteString;

      Canvas: TCanvas; StyleNo: Integer;

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

      DrawState: TRVTextDrawStates;

      var DoDefault: Boolean) of object;

(introduced in version 1.3; new states in TRVTextDrawStates since 1.4)

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

Input parameters:

Sender – TRVStyle generating the event.

s – text to draw. For Unicode text styles, this is "raw Unicode".

Canvas – canvas to paint.

StyleNo – index of text style in TextStyles collection.

Background (if exists) should fill the rectangle Left, Top, Width, Height. Text should be drawn at the position (Left+SpaceBefore, Top). SpaceBefore is positive for justify-aligned paragraphs.

DrawState – states of this text item, 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.

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:

OnApplyStyle;

OnApplyStyleColor;

OnDrawTextBack.

See also properties:

TextStyles.

Demo projects:

Demos\Delphi\Assorted\Custom Draw\

Demos\CBuilder\Assorted\Custom Draw\


RichView © Sergey Tkachenko