473,587 Members | 2,516 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1556
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 PrintPageEventA rgs
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.Ge nericTypographi c.
There are a lot of articles on this and other drawing/printing things in
microsoft.publi c.dotnet.framew ork.drawing.

Ron Allen
"Jack Russell" <ja***@norubbis h.tpg.com.au> wrote in message
news:ux******** ******@TK2MSFTN GP14.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 PrintPageEventA rgs
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.Ge nericTypographi c.
There are a lot of articles on this and other drawing/printing things in
microsoft.publi c.dotnet.framew ork.drawing.

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

My understanding is that I set up and do all of my printing in the
printdocume nt 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
4096
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 PrintDialog control under a security setting with only SafePrinting allowed. I have attached a sample project that I am using to try to accomplish...
8
3340
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 ran it, it failed The codes are using System class Test
3
404
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
350
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 that correct? If so how do I force a form feed?
6
3238
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 (much like the current model), but my PrintDocument would have a Pages collection such that each time you need to have an additional page, you would...
3
1611
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 all the printing settings defined, so no PrintDialog is needed. However, when printing starts, the application displays a print notification window...
14
5892
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
2405
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 make a simple program that takes 10 sets of numbers from a text file which it reads the Length, Width and Height from. Then the program works out the...
18
11273
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 classes, for each of the checked rows in the GridView. This works fine in the Visual Studio 2005 development environment on localhost. But, when I...
0
7852
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8216
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8349
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
8221
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6629
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3845
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2364
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1455
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1192
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.