Hi Nicholas, Hi Tim
I have a similar Problem. Creating my own "PrintPreview" I like to show
a Page-Selctor like: "Page ... of XYZ"
I think its not up to me....
E.G.
If there is a PrintDocument (created manually or by ReportGenerator
....) I can set the PrinterSettings and the PageSettings -->
consequently the number of Pages need to calculatet.
Besides :
The PrintPreviewControl.StartPage can not set to values >=
"PageCount"-1
There is a (not reliable) workaround to get the number of pages
(ppv1 is a PrintPreviewControl)
int currentPage = this.ppv1.StartPage;
this.ppv1.StartPage = 999999;
int pages = this.ppv1.StartPage+1;
this.ppv1.StartPage = currentPage;
No Exception happends but
pages contains now the number of pages of the PrintDocumnet "previewd"
with ppv1.
Funnily enough this works only it the PrintPreviewControl is visible on
screen !? So at the moment i do without "Page ... of XYZ"
Hope there is a propper way to get "Number of pages"
Peter
Nicholas Paldino [.NET/C# MVP] schrieb:
[color=blue]
> Tim,
>
> Well, that's completely up to you. Since you are printing out
> everything custom, you have to figure out, according to the data you are
> laying out, what the number of pages will be. That's completely up to you.
>
> Hope this helps.
>
>
> --
> - Nicholas Paldino [.NET/C# MVP]
> -
mvp@spam.guard.caspershouse.com
>
> "Tim" <tim@home.com> wrote in message
> news:m8P4f.18491$GH1.136711@news20.bellglobal.com. ..[color=green]
> > Hi,
> >
> > I am creating my own method for printing. I am using PrintDocument and
> > cycling through the data and creating new pages as neccessary.
> >
> > My question is, how can I know that total number of pages so that I can
> > put "Page 1 of 5" on the first page and also I would know when to draw the
> > report footer?
> >
> > Can anyone offer any advice?
> >
> > Tim
> >[/color][/color]