| GetTextScreenRect method |
Applies to
TWPRTFEnginePaint
Declaration
function GetTextScreenRect(par: TParagraph; posinpar: Integer; var x, y, w, h: Integer; CharOffset: Boolean = FALSE; linenr: Integer = -1; pagenr: Integer = -1; FavourizeEnd: Boolean = FALSE): Boolean;
Description
This function calculates the coordinates of the line. It can be usedful to highlight a certain line or paragraph temporarily:
var x,y,w,h, x1,y1,w1,h1 : Integer;
begin
// Get Rect of first line
WPRichText1.Memo.GetTextScreenRect(
WPRichText1.ActiveParagraph,
0,
x,y,w,h );
// Get Rect of last Line
WPRichText1.Memo.GetTextScreenRect(
WPRichText1.ActiveParagraph,
MaxInt,
x1,y1,w1,h1 );
// Paint the rectangle
WPRichText1.Canvas.Brush.Style := bsClear;
WPRichText1.Canvas.Pen.Color := clRed;
WPRichText1.Canvas.Pen.Width := 0;
WPRichText1.Canvas.Rectangle(x,y,x1+w1,y1+h1);
ShowMessage(WPRichText1.ActiveParagraph.AGetWPSS(true,true,true));
WPRichText1.Invalidate;
end; |
|
Copyright (C) by WP |