473,389 Members | 1,097 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,389 software developers and data experts.

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 1530
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Jody Gelowitz | last post by:
I am trying to find the definition of "Safe Printing" and cannot find out exactly what this entitles. The reason is that I am trying to print contents from a single textbox to no avail using the...
8
by: Tony | last post by:
Hello I am learning C# and encountered the following problem when I tried to figure out how to print the string {0} in a Console window The following piece of codes complied OK. But when I...
3
by: adam | last post by:
Is there not a way to do a simple print like in vb6? Printer.Print All I want to do is put a could of text lines on a page.
2
by: Jack Russell | last post by:
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...
6
by: Chris Dunaway | last post by:
The method for printing documents in .Net can be confusing, especially for newer users. I would like to create a way to simplify this process. My idea would be implemented using a PrintDocument...
3
by: Milan Todorovic | last post by:
Hello, I need help with something that should be pretty trivial, but I can't seem to find an easy way to do it. I have a printing routine set up in a windows vb.net 2005 app. The routine has...
14
by: dba_222 | last post by:
Dear experts, Again, sorry to bother you again with such a seemingly dumb question, but I'm having some really mysterious results here. ie. Create procedure the_test As
1
by: epilogue | last post by:
Hey guys Im pretty new to Java and while I am finding it enjoyable i am getting several errors!!! Do you think you could help me on this particular question of an Assignment im doing. I have to...
18
by: Brett | last post by:
I have an ASP.NET page that displays work orders in a GridView. In that GridView is a checkbox column. When the user clicks a "Print" button, I create a report, using the .NET Framework printing...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.