rvico TRichView Reference | TRVStyle

TRVStyle.OnDrawStyleText

Top  Previous  Next

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

property OnDrawStyleText: TRVDrawStyleTextEvent

 

type

  TRVDrawStyleTextEvent = procedure (Sender: TRVStyle;
    const s: TRVRawByteString; Canvas: TCanvas; StyleNo: Integer;
    SpaceAtLeft, Left, Top, Width, Height
    {$IFDEF RVUSEBASELINE},BaseLine{$ELSE}{$IFDEF RVHIGHFONTS},DrawOffsY{$ENDIF}{$ENDIF}: Integer;
    TextWidth, SpaceCount: Integer;
    DrawState: TRVTextDrawStates;
    Printing, PreviewCorrection, ForMetafile: Boolean;
    ColorMode: TRVColorMode; DefBiDiMode: TRVBiDiMode;
    RefCanvas: TCanvas;
    LeftNoExpIndex, RightNoExpIndex: Integer;
    var DoDefault: Boolean) of object;

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

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:

OnApplyStyle;

OnApplyStyleColor;

OnDrawTextBack.

See also properties:

TextStyles.

Demo projects:

Demos\*\Assorted\Custom Draw\


TRichView © trichview.com