TCustomRichViewEdit.OnDrawCurrentLine

<< Click to display table of contents >>

TCustomRichViewEdit.OnDrawCurrentLine

Allows to highlight the current line (i.e. the line containing the caret).

VCL and LCL:

  TRVDrawCurrentLineEvent = procedure(Sender: TCustomRichViewEdit;
    ACanvas: TCanvas; ARVData: TCustomRVFormattedData;
    AStartItemNo, AStartOffs, AEndItemNo, AEndOffs: Integer;
    const ARect: TRVCoordRect; APrepaint: Boolean) of object;
property OnDrawCurrentLine: TRVDrawCurrentLineEvent;

FMX:

  TRVDrawCurrentLineEvent = procedure(Sender: TCustomRichViewEdit;
    ACanvas: TRVFMXCanvas; ARVData: TCustomRVFormattedData;
    AStartItemNo, AStartOffs, AEndItemNo, AEndOffs: Integer;
    const ARect: TRVCoordRect; APrepaint: Boolean) of object;

 

property OnDrawCurrentLine: TRVDrawCurrentLineEvent;

(introduced in version 21)

Parameters:

Canvas canvas to paint.

ARVData document containing the current line (Sender.RVData)

AStartItemNo index of the first item on this line (in the range from 0 to ARVData.ItemCount - 1)

AStartOffs position of the line start in AStartItemNo (0 for a non-text item; 1-based index of the first character on the line for a text item)

AEndItemNo index of the last item on this line (in the range from 0 to ARVData.ItemCount - 1)

AEndOffs position of the line end in AEndItemNo (1 for a non-text item; 1-based index of the last character on the line + 1 for a text item)

ARect rectangle covering this line

APrepaint False, reserved for future use. This event is always called when all other content is already drawn.

 

Example: highlighting with semitransparent yellow color

procedure TForm1.RichViewEdit1DrawCurrentLine(

  Sender: TCustomRichViewEdit; ACanvas: TRVFMXCanvas; 

  ARVData: TCustomRVFormattedData; AStartItemNo,
  AStartOffs, AEndItemNo, AEndOffs: Integer; 

  const ARect: TRectF; APrepaint: Boolean);
begin

  if not Prepaint then
    Sender.Style.GraphicInterface.FillRectAlpha(ACanvas, ARect, rvclYellow, 50);
end;