Function TWPCustomRtfEdit.GetTextScreenRect(par:TParagraph; posinpar:Integer; X:Integer; Y:Integer; W:Integer; H:Integer; CharOffset:Boolean) : Boolean

Unit: WPCTRMemo
Class: WPCTRMemo.TWPCustomRtfEdit

Parameters

  • par:TParagraph
  • posinpar:Integer
  • X:Integer
  • Y:Integer
  • W:Integer
  • H:Integer
  • CharOffset:Boolean

Returns

The type of the result value is Boolean.

Description

This function calculates the coordinates of the line which contains a certain position of a certain paragraph in screen coordinates. This function is used by the ruler to update the text area but can also be used to invert a block on the screen or for similar effects. If the parameter CharOffset = TRUE this function calculates the position of a single character.
var x,y,w,h : Integer; begin WPRichText1.GetTextScreenRect( WPRichText1.Memo.Cursor.active_paragraph, WPRichText1.Memo.Cursor.active_posinpar, x,y,w,h ); WPRichText1.Canvas.Brush.Style := bsClear; WPRichText1.Canvas.Pen.Color := clRed; WPRichText1.Canvas.Rectangle(x,y,x+w,y+h); end;