Re: VB Printer Dialog Problem (VB6)
- From: "Mike Williams" <Mike@xxxxxxxxxxxxxxxxx>
- Date: Mon, 3 Jul 2006 10:59:50 +0100
<andy.vandierendonck@xxxxxxxxxx> wrote in message news:1151918512.530634.13860@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
It should be better if we make another
topic: Useful Print tips (VB6) :-)
Yeah. It is getting a bit long this thread :-)
Now at first, I understand the thing with the bottom
margin. I'll modify my code, the less problems I
have, the better!
Yes. And the right margin as well. Don't forget that. You'll find that if you code it in the way I have suggested it will work reliably on all printers. Also, if you code the rest of your stuff properly, it will also work correctly even if the user chooses to use landscape instead of portrait, or perhaps switches to a different paper size.
the 'DummyRun'. Printer.KillDoc gave me already
problems. Sometimes it happens that the Document
to kill not dissapears in the printer waitlist. As status
it display: "Removing..." But after a few hours it still
is removing.
Yes. I did say that was not the method I would recommend. I've never actually used it myself and I just threw it into the melting pot in case you didn't fancy amending your code in accordance with my main suggested method. I tested KillDoc here just on a very simple print job and it worked fine, but I had visions of it causing problems with more complex print jobs and possibly on certain specific printers. But my suggested method of altering the CurrentX and CurrentY positions instead of actually printing the stuff and then setting them to zero instead of doing a NewPage works fine and is reliable:
With Printer
If DummyRun = False Then
.Print TextToPrint
Else
.CurrentY = .CurrentY + TextHeight(TextToPrint)
End If
End With
That method, as I suggested in my post, is very sound and you won't have any problems with it. In fact it is essentially the very same method that is used by the DrawText API when you use the DT_CALCRECT flag and by the RichTextBox when you send it an EM_FORMATRANGE message with a wParam of False (Do Not Render). Of course you'll also have to similarly change any code that draws lines or boxes or circles or paints pictures, in the way that I have also suggested, but that shouldn't be too much of a problem.
Thank you very much for all the help!
You're welcome.
Mike
.
- References:
- Re: VB Printer Dialog Problem (VB6)
- From: andy . vandierendonck
- Re: VB Printer Dialog Problem (VB6)
- From: Mike Williams
- Re: VB Printer Dialog Problem (VB6)
- From: andy . vandierendonck
- Re: VB Printer Dialog Problem (VB6)
- From: Mike Williams
- Re: VB Printer Dialog Problem (VB6)
- From: andy . vandierendonck
- Re: VB Printer Dialog Problem (VB6)
- Prev by Date: Re: VB Printer Dialog Problem (VB6)
- Next by Date: Re: Create pictures array in run time
- Previous by thread: Re: VB Printer Dialog Problem (VB6)
- Next by thread: Re: VB Printer Dialog Problem (VB6)
- Index(es):
Relevant Pages
|