trichview.com

trichview.support




Footer: Page number


Return to index


Author

Message

Stefan M. Huber

Posted: 08/16/2004 14:57:15


Hi!


   First let me thank you for your richview implementation, Sergey.


Here's what tried to get the page number onto the footer:



procedure TForm2.RVPrintPagePrepaint(Sender: TRVPrint; PageNo: Integer;

   Canvas: TCanvas; Preview: Boolean; PageRect, PrintAreaRect: TRect);

var sz: TSize;

     s: string;

     ScaleX, ScaleY : Extended;

begin

   ScaleX := GetDeviceCaps(canvas.Handle, LOGPIXELSX) / 25.4;

   ScaleY := GetDeviceCaps(Canvas.Handle, LOGPIXELSY) / 25.4;

   Canvas.Font.Name := RVStyle.TextStyles.Items[0].FontName;

   Canvas.Font.Size := RVStyle.TextStyles.Items[0].Size;

   s := 'Page ' + IntToStr(PageNo) + ' of ' + IntToStr(RVPrint.PagesCount);

   sz := Canvas.TextExtent(s);

   Canvas.TextOut(PageRect.Right-Trunc(ScaleX*RVPrint.RightMarginMM)-sz.cx,

                  PageRect.Bottom-Trunc(ScaleY*RVPrint.FooterYMM)-sz.cy, s);

end;


The problem I have is that I obviously can't find the proper location for 

the text "Page x of Y". What am I doing wrong?


Thanks,

Stefan





Powered by ABC Amber Outlook Express Converter