daveofgv
Well-known member
Presently, I am using VB6, on printing a large image on multiple pages:
I need this to work on vb.net 2008 pro instead. Anyone know how or a better way?
Also, I need my application to reside in the list of printers when the user clicks a print button and the print dialog box opens.
Can anyone help?
Thanks
daveofgv
VB.NET:
Private Sub Command3_Click()
'Print the picture on multiple sheets.
'Load the dimensions of the image and printer into memory
lngPictureWidth = Picture1.Picture.Width
lngPictureHeight = Picture1.Picture.Height
lngPrinterWidth = Printer.Width
lngPrinterHeight = Printer.Height
'Calculate the ratios
sngWidthRatio = lngPictureWidth / lngPrinterWidth
sngHeightRatio = lngPictureHeight / lngPrinterHeight
'Calculate how many pages are required to print the picture
intPageWidth = constMaxValue - Int(constMaxValue - sngWidthRatio)
intPageHeight = constMaxValue - Int(constMaxValue - sngHeightRatio)
For bytWidthCount = 1 To intPageWidth
'Calculate the x-offset
lngXCoor = -lngPrinterWidth * (bytWidthCount - 1)
For bytHeightCount = 1 To intPageHeight
'Calculate the y-offset
lngYCoor = -lngPrinterHeight * (bytHeightCount - 1)
'Use the Paint Picture method to print the picture
Printer.PaintPicture Picture1.Picture, _
lngXCoor, _
lngYCoor, _
lngPictureWidth, _
lngPictureHeight
'start a new page
Printer.NewPage
Next bytHeightCount
Next bytWidthCount
Printer.EndDoc
MsgBox "Done Sending Info to Printer"
End Sub
I need this to work on vb.net 2008 pro instead. Anyone know how or a better way?
Also, I need my application to reside in the list of printers when the user clicks a print button and the print dialog box opens.
Can anyone help?
Thanks
daveofgv