473,396 Members | 1,859 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,396 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 1531
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: 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?
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.