Re: printing using tabs
- From: "Mike Williams" <mike@xxxxxxxxxxxxxxxxx>
- Date: Thu, 27 Jul 2006 08:30:30 +0100
"Mitch5713" <mitch@xxxxxxxx> wrote in message
news:DE55D54C-783B-475B-B187-E1788A11D9F8@xxxxxxxxxxxxxxxx
Mike: Once again thanks for all your help
You're welcome.
I've elected to use the PrintForm method . . .
[cue sharp intake of breath!] Yuck!
Why in the following code does the printer NOT be
set to Duplex?????
Printer.Duplex = vbPRDPHorizontal
Form1.PrintForm
Form2.PrintForm
You should avoid the VB PrintForm method like the plague! It is an
abomination! There are so many problems with it that it is *never* worth
considering as an option. In your specific case, the problem is that the VB
PrintForm method sends a bitmap of your entire Form to the printer (on a
good day, and when the wind is easterly and when Saturn occludes the
terrestrial view of Jupiter!) and it then ends the document (the equivalent
of the VB Printer.EndDoc method). That is one of its many faults. It ends
the document and does not allow you to print anything else on that page.
There are lots of other faults as well. Anyway, what that means is that your
code sample (as shown above) is the equivalent of:
Printer.Print [something - your Form1 in this case]
Printer.EndDoc
Printer.Print [something else - your Form2 in this case]
Printer.EndDoc
Whereas in fact to print two separate pages of a single document (in which
case your Duplex would work fine) you need to be doing:
Printer.Print [something - your Form1 in this case]
Printer.NewPage ' <<<<< note the difference from the code above >>>>
Printer.Print [something else - your Form2 in this case]
Printer.EndDoc
So, using the VB PrintForm method (yuck, I feel sick just at the mention of
the name!) you cannot possibly do the latter because PrintForm automatically
does the equivalent of an EndDoc. You really need to use a different way of
printing your stuff. The VB PrintForm method, as I have already said, prints
a bitmap of your Form (if you're lucky!). However, there are various
alternative ways of printing a bitmap of the Form. If you really do want to
stick with dumping low resolution (typically 96 dpi) screen bitmaps of your
Form to the printer then post again and I (and many others here) will show
you how to do it in a way that is very much more flexible and much more
useful than the printForm method. I would strongly advise against it though.
Personally I would advise you to use the various VB Printer Object methods
(Print, Line, PaintPicture etc, etc) to draw what you want to the printer.
This gives you the very much higher resolution of the printer to work with
(typically 600 dpi or greater). It obviously requires you to write a bit
more code, but it is capable of producing professional, high resolution,
high quality output for you. You really should treat a Form and a printed
page in two completely different ways. A Form is a simple low resolution
image of whatever it is you want to display, together with various objects
with which the user can interact (buttons, menus, Combo Box drop down
arrows, close buttons, minimize buttons, various boxes containing text all
that sort of stuff). It is ideal for displaying stuff on screen to the user.
I looks good on the screen and the user can interact with it. However, it
looks crap on the printer (text is very rough for a start!). The printed
page should be regarded as a high resolution display that the user can pick
up and handle and read at close quarters. It should display its stuff (text
and drawings and everything else) at the high resolution and quality that
the printer is capable of, and it should contain nothing in the way of "user
interaction" stuff (no little arrows a the side of Combo Boxes for example,
and all sorts of other things). What's the point of showing someone a little
arrow on a printed page? He can't click the thing! There are of course
certain circumstances where you do want those sort of things shown on a
printed page (a drawing of a screen object shown in a "teach yourself" text
book, for example). But even in those cases you want all the rest of the
stuff on the page (all the text, for example) printed at a high resolution.
Forms and printed pages are two completely different things and are used for
two completely different purposes, and you should treat them differently in
your code. [Okay, rant over! I think I must in future write newsgroup
replies after my breakfast instead of before it ;-) ]
Anyway, you now know the reason why your Duplex setting is not doing what
you hoped it would do in the code you posted. It's up to you now to make up
your mind whether you want to continue with your "dumping low resolution
bitmaps to the printer" method or whether you now want to change to a
different method using the VB Printer Object drawing methods to achieve high
resolution output. In either case post back and the people here will show
you how to do it.
Mike - MVP Visual Basic
.
- Follow-Ups:
- Re: printing using tabs
- From: Mitch5713
- Re: printing using tabs
- From: Mitch5713
- Re: printing using tabs
- References:
- Re: printing using tabs
- From: Mike Williams
- Re: printing using tabs
- From: Mitch5713
- Re: printing using tabs
- Prev by Date: Error - Multiple step OLE DB operation generatied errors. Check each status value
- Next by Date: Re: Treeview - weird icon question
- Previous by thread: Re: printing using tabs
- Next by thread: Re: printing using tabs
- Index(es):