 |
| AndreaVB Forum : Printing : print a whole picture box or form at 600 dpi including the controls over it, is it possible? |
|
|
|
GeoffS Level: VB Lord

 Registered: 29-09-2004 Posts: 536
|
Re: print a whole picture box or form at 600 dpi including the controls over it, is it possible?
Ah - I thought you were trying to Print using the Printer Object.
It is not possible to change the print quality when using the PrintForm Method. This method is designed mainly for simple text printing and uses the dpi of the screen, which is usually a heck of a lot less than 300 which is why you get such poor graphics quality.
To get a graphic to print at a decent quality you must use the "PaintPicture" method of the "Printer" Object.
The following code will get the graphics from a PictureBox control, reduce it(if necessary) so that it is no more than 80% of the page width and no more than the height of 10 lines of text, and then Print it centralised on the page.
Dim intPageWidth As Integer, intLineHeight As Integer, intStartPos As Integer
Dim sinPicWidth As Single, sinPicHeight As Single, sinReduce As Single
intPageWidth = Printer.ScaleWidth
intLineHeight = Printer.TextHeight("X")
sinPicWidth = Me.PictureBox1.Picture.Width
sinPicHeight = Me.PictureBox1.Picture.Height
sinReduce = 0.8
Do Until sinPicWidth < (intPageWidth * 0.8) And sinPicHeight < (intLineHeight * 10.01)
sinPicWidth = sinPicWidth * sinReduce
sinPicHeight = sinPicHeight * sinReduce
sinReduce = sinReduce - 0.05
Loop
intStartPos = CInt((intPageWidth - sinPicWidth) / 2)
Printer.PaintPicture Me.PictureBox1.Picture, intStartPos, Printer.CurrentY, sinPicWidth, sinPicHeight
Printer.EndDoc
|
____________________________
multi-tasking - the ability to hang more than one app. at the same time.
|
|
27-10-2004 at 08:33 AM |
|
|
| AndreaVB Forum : Printing : print a whole picture box or form at 600 dpi including the controls over it, is it possible? |
|
|
|
 |
 |