daz84
asked on
Zoom/resize using PrintForm control
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
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!
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()
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!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That example didn't really help much, I found a better one here
http://www.vb-helper.com/howto_net_image_rotate.html
However on implementing that I get the same result, a blank image. Which leads me back to my conclusion that it is not the procedure that is wrong, but my handling of the bitmap object being passed back out of the procedure.
I still feel my rotate procedure should be working, I am convinced that it is my handling of the object that is causing the problem as the procedure for rotation itself seems fairly trivial.
http://www.vb-helper.com/howto_net_image_rotate.html
However on implementing that I get the same result, a blank image. Which leads me back to my conclusion that it is not the procedure that is wrong, but my handling of the bitmap object being passed back out of the procedure.
I still feel my rotate procedure should be working, I am convinced that it is my handling of the object that is causing the problem as the procedure for rotation itself seems fairly trivial.
ASKER
Been experimenting with Scaletransform and Rotatetransform methods but it's nearly 1am. I'll try again after some sleep and some coffee, any more suggestions are welcome in the mean time
ASKER
Sorry I have kinda abandoned this, I have been side tracked by other projects and am unable to put the time into completing this right now.
Thank you for your answer, I have awarded a B grade for it as it didn't solve my problem but did offer some very useful links which I can use when I get back to this project.
Thank you for your answer, I have awarded a B grade for it as it didn't solve my problem but did offer some very useful links which I can use when I get back to this project.
ASKER
This however causes another issue, the code I had in place before this rotated the image to landscape as the layout of my form is better suited to a landscape view. There is clearly no such property for a bitmap so I had a bash at a procedure for this.
Open in new window
However it appears to output nothing at all, am I missing something obvious?