We help IT Professionals succeed at work.
Get Started

Zoom/resize using PrintForm control

daz84
daz84 asked
on
5,415 Views
Last Modified: 2012-05-12
I am looking to print the contents of a form that is on the screen, eventually I will want to print part of the form but not all of it, but that is for another day.

So far I have the form printing using this code
        Dim x As Integer, y As Integer
        PrintForm1.Form = Me
        PrintForm1.PrinterSettings.DefaultPageSettings.Landscape = True
        x = PrintForm1.PrinterSettings.DefaultPageSettings.PrintableArea.Width
        y = PrintForm1.PrinterSettings.DefaultPageSettings.PrintableArea.Height
        MsgBox("Printer area: " & vbCrLf & y & " x " & x & vbCrLf & vbCrLf & "Screen area: " & vbCrLf & Me.Width & " x " & Me.Height, , "Printable Area")
        PrintForm1.PrintAction = Printing.PrintAction.PrintToPreview
        PrintForm1.Print()

Open in new window


You can see from my code that I have dropped in a message box to tell me what the resolution of the paper is and what the size of my form is (Printer area is 1113 x 800 and Screen area is 1366 x 768). You will also see I have set it to print preview rather than print, purely to save paper during testing.

My goal is to resize the image of the form to the size of a landscape A4 sheet of paper (which in this case appears to be 1113x800) .

Obviously I cannot simply resize the form, as that would lose some information. I want the entire contents of my form to exactly fit the single sheet of A4.

An hour of googling has got me nowhere and MSDN doesn't seem to be of any use either. Any help is much appreciated!
Comment
Watch Question
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2014
Commented:
This problem has been solved!
Unlock 1 Answer and 6 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE