ScottF
Nov 25th, 1999, 06:52 PM
I have try many way to print a form with control on it, on a letter size paper(8 x 11). Used Picturebox, even changing the resolution of the screen(this help some) but still it does not print like a doc. I use the form like a invoice. I need some help.
Joacim Andersson
Nov 26th, 1999, 10:34 PM
Try using the StrechBlt API function:
Public Declare Function StretchBlt _
Lib "gdi32" Alias "StretchBlt" ( _
ByVal hdc As Long, _
ByVal x As Long, _
ByVal y As Long, _
ByVal nWidth As Long, _
ByVal nHeight As Long, _
ByVal hSrcDC As Long, _
ByVal xSrc As Long, _
ByVal ySrc As Long, _
ByVal nSrcWidth As Long, _
ByVal nSrcHeight As Long, _
ByVal dwRop As Long) As Long
Public Const SRCCOPY = &HCC0020
Public Sub PrintForm(frm As Form, lngWidth As Long, lngHeight As Long)
Printer.Print 'Importent! The printer object may not have an hDC if it hasn't been used.
Call StrechBlt(Printer.hDC, 0, 0, lngWidth, lngHeight, _
frm.hDC, 0&, 0&, frm.ScaleWidth, frm.ScaleHeight, SRCCOPY)
Printer.EndDoc
End Sub
Copy the above code to a BAS module and call the PrintForm sub with the following arguments:
frm = The Form you want to print
lngWidth = The width of the printed output
lngHeight = The height of the printed output
Good luck!
------------------
Joacim Andersson
joacim@programmer.net
joacim@yellowblazer.com
www.YellowBlazer.com (http://www.YellowBlazer.com)
ScottF
Nov 28th, 1999, 12:38 AM
Ok i'm just now starting to use module so help me out. My form name is frmMain and I use 8.5 X 11 paper.