Solved

Matching Printer "Page Break" in PictureBox

Posted on 2000-05-04
3
166 Views
Last Modified: 2013-11-22
I manually produce a report in my program using either Printer.Print or MyPictureBox.Print statements depending on the user's choice of whether he/she wants to print or preview the report. I would like to be able to produce pages in the picturebox that exactly match what is printed on the printer, in other words the same number of lines of print in both. I can't simply count the lines that go to the printer and use that in the picturebox processing because I don't do the printer logic unless the user requests Print. I only use one size font so I assumed I could come up with code that would work by useing the relationship between the Printer.ScaleHeight and the factor I get when I divide Printer.TextHeight("test") by MyPictureBox.Textheight("test") but I couldn't get it to work. Can someone help?
0
Comment
Question by:Martin Liss
  • 2
3 Comments
 
LVL 14

Accepted Solution

by:
mcrider earned 100 total points
ID: 2777674
Try something like this:

Picture1.Height = Printer.Height
Picture1.Width = Printer.Width
Set Picture1.Font = Printer.Font

Then as you're printing look at the CurrentY Property.  If it's going to print in the footer margin you specify, you need to move to a new page...


Cheers!®©
0
 
LVL 46

Author Comment

by:Martin Liss
ID: 2941174
Comment accepted as answer
0
 
LVL 46

Author Comment

by:Martin Liss
ID: 2941175
It's not the whole answer, but it's the only one I've gotten.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
MsgBox 2 47
Looking for VB6 code to read SQL table export it to ascii 8 31
How to remove Recent Projects from Embarcadero C++ builder XE10. Berlin 2 30
MsgBox 4 43
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now