TSRichViewEdit.OnPaintPage |
Top Previous Next |
|
Occurs before and after the page is drawn. type TSRVPaintPage = procedure(Sender: TObject; PageNo: Integer; PageRect, R: TRect; Canvas: TCanvas; Prepaint, Printing: Boolean) of object;
property OnPaintPage: TSRVPaintPage; You can draw something on below or above the default drawing. PageNo – index of the page, from 1. PageRect – rectangle where to draw the page. Its size is the page size in 100% zooming. R – client coordinates of area that needs to be repainted. Canvas – canvas where to paint. Prepaint is True if this event is called before the default drawing (to draw a background), and False otherwise. Printing is True if this event is called for printing the page. You should paint as if zooming is 100%. When drawing on the screen, all painting made in this event is automatically scaled according to ViewProperty.ZoomPercent.
Example: drawing page numbers procedure TForm1.SRichVewEdit1PaintPage(Sender: TObject; PageNo: Integer; PageRect, R: TRect; Canvas: TCanvas; Prepaint, Printing: Boolean); var H : Integer; Text: String; begin if Prepaint then exit; Canvas.Brush.Style := bsClear; Canvas.Font.Assign(SRichViewEdit1.RichViewEdit.Style.TextStyles[0]); H := SRichViewEdit1.TopMargin100Pix; Text := 'Page ' + IntToStr(PageNo); Canvas.TextOut((PageRect.Left + PageRect.Right - Canvas.TextWidth(Text)) div 2, PageRect.Top+H div 2, Text); end;
See also: |