468,469 Members | 2,227 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,469 developers. It's quick & easy.

simple printing question

Gee vb.net makes me feel dumb!

My understanding is that I set up and do all of my printing in the
printdocument printpage and handler using various graphics methods such
as drawstring.

Is that correct?

If so how do I force a form feed?

Thanks

Jack Russell
Jul 21 '05 #1
2 1374
Jack,
A formfeed/page eject occurs when you return from the OnPrintPage event
of the document. So, you need to keep track of your print position outside
that (I normally use class variables for my PrintDocument subclass) and draw
each page image in OnPrintPage. Set HasMorePages on the PrintPageEventArgs
variable to true when another page needs to be done before returning and set
it to false when the print job is complete.
Yes, DrawString and the other drawing methods are for drawing on the
page. Normally using PrintDocument requires a slightly different logic path
for printing than previous MS methods for VB6, C++ although it is closer to
C++.
Note that to get precise width/height of strings for alignment or
centering you need to use one of the MeasureString overrides that includes a
StringFormat and supply an instance of StringFormat.GenericTypographic.
There are a lot of articles on this and other drawing/printing things in
microsoft.public.dotnet.framework.drawing.

Ron Allen
"Jack Russell" <ja***@norubbish.tpg.com.au> wrote in message
news:ux**************@TK2MSFTNGP14.phx.gbl...
Gee vb.net makes me feel dumb!

My understanding is that I set up and do all of my printing in the
printdocument printpage and handler using various graphics methods such
as drawstring.

Is that correct?

If so how do I force a form feed?

Thanks

Jack Russell

Jul 21 '05 #2
Ron,

Thanks

Jack

Ron Allen wrote:
Jack,
A formfeed/page eject occurs when you return from the OnPrintPage event
of the document. So, you need to keep track of your print position outside
that (I normally use class variables for my PrintDocument subclass) and draw
each page image in OnPrintPage. Set HasMorePages on the PrintPageEventArgs
variable to true when another page needs to be done before returning and set
it to false when the print job is complete.
Yes, DrawString and the other drawing methods are for drawing on the
page. Normally using PrintDocument requires a slightly different logic path
for printing than previous MS methods for VB6, C++ although it is closer to
C++.
Note that to get precise width/height of strings for alignment or
centering you need to use one of the MeasureString overrides that includes a
StringFormat and supply an instance of StringFormat.GenericTypographic.
There are a lot of articles on this and other drawing/printing things in
microsoft.public.dotnet.framework.drawing.

Ron Allen
"Jack Russell" <ja***@norubbish.tpg.com.au> wrote in message
news:ux**************@TK2MSFTNGP14.phx.gbl...
Gee vb.net makes me feel dumb!

My understanding is that I set up and do all of my printing in the
printdocument printpage and handler using various graphics methods such
as drawstring.

Is that correct?

If so how do I force a form feed?

Thanks

Jack Russell


Jul 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Jody Gelowitz | last post: by
8 posts views Thread by Tony | last post: by
3 posts views Thread by adam | last post: by
2 posts views Thread by Jack Russell | last post: by
6 posts views Thread by Chris Dunaway | last post: by
1 post views Thread by epilogue | last post: by
18 posts views Thread by Brett | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.