Hi!

I posted a message on the other day, but i still have some doubts.
What i want to do is just to print some pages drawn in a
printdocument, since that the printdialog has a property called
"Allowsomepages". I set this property to true, but when I am going to
print something and chose that option, it stills print all pages.
Where is my error? Is it supoosed not to draw the specified pages in
the printdialog or is it automatic and I am missing something?? Any
help with examples would be great

Thanks in advance
Dante

Re: printing doubt by Ron

Ron
Thu Jul 01 11:26:08 CDT 2004

Dante,
I don't have an example since none of my users have asked for this. You
need to handle the pages to be drawn yourself. Note untested pseudo-logic
below

public myPrintDoc : PrintDocument
{
private int pgno = 0;
private ArrayList pgs;
private int maxPages;

public myPrintDoc(ArrayList pgsToPrint, int maxPageNo)
{
pgs = pgsToPrint;
maxPages = maxPageNo;
}

protected override void OnPrintPage(PrintPageEventArgs e)
{
while ((pgno < maxPages) && ( ! pgsToPrint.Contains(pgno)))
{
pgno++; // get this page's #
// now advance the print stream to the next page
}
// print this page here
pgno++; // and advance to the next
}
if (pgno < maxPages)
e.HasMorePages = true;
else
e.HasMorePages = false;
}
}

Ron Allen
"Dante" <dante_@netcabo.pt> wrote in message
news:c5ef56ad.0406301303.18808369@posting.google.com...
> Hi!
>
> I posted a message on the other day, but i still have some doubts.
> What i want to do is just to print some pages drawn in a
> printdocument, since that the printdialog has a property called
> "Allowsomepages". I set this property to true, but when I am going to
> print something and chose that option, it stills print all pages.
> Where is my error? Is it supoosed not to draw the specified pages in
> the printdialog or is it automatic and I am missing something?? Any
> help with examples would be great
>
> Thanks in advance
> Dante