            ----------------------------------
            Microsoft PRTLGPCT.EXE Readme File
                     November 1997
            ----------------------------------

         (c) Copyright Microsoft Corporation, 1997

The PaintPicture method of the Picture object allows you to print the
picture. However, this method will adjust the picture size to fit on a
single sheet of paper. This article shows you how to print a large picture
on multiple sheets of paper.

When you run the self-extracting file, the following files are expanded
into the Printing Large Pictures Project on your hard drive:

 - Form1.frm     4,750 bytes
 - Prtlgpct.vbp    650 bytes
 - Prtlgpct.vbw     49 bytes
 - Readme.txt    5,109 bytes You are currently reading this file.

MORE INFORMATION
================

To print a large picture over several sheets, you start by calculating the
ratio of the picture's height and width to the maximum height and width the
printer can print. From this ratio, you can calculate the number of pages
required to print the picture completely. With each page, you use the
PrintPicture method to print the maximum image on that sheet. Keep
repeating this process on each successive page until the picture is
completely printed.

The next section shows you how to create a sample program to demonstrate
this technique.

Step-by-Step Example
--------------------

1. Start a new project in Visual Basic. Form1 is created by default.

2. Add three CommandButtons, a Common Dialog control, and a Picture
   control to Form1.

3. Copy the following code to the Code window of Form1:

      Option Explicit

      Const constMaxValue = 32767

      Dim lngPrinterWidth As Long, lngPrinterHeight As Long
      Dim lngPictureWidth As Long, lngPictureHeight As Long
      Dim lngXCoor As Long, lngYCoor As Long
      Dim sngWidthRatio As Single, sngHeightRatio As Single
      Dim intPageWidth As Integer, intPageHeight As Integer
      Dim bytWidthCount As Byte, bytHeightCount As Byte

      Private Sub cmdLoad_Click()
         'Opens the common dialog box so you can select a picture file
         'to load into the Picture object.
         Dim picFile As Picture
         CommonDialog1.Filter = "JPEG files|*.jpg|BMP files|*.bmp"
         CommonDialog1.ShowOpen

         If CommonDialog1.filename <> "" Then
            Set picFile = LoadPicture(CommonDialog1.filename)
            Set Picture1.Picture = picFile
            Form1.Height = Picture1.Height + 1700
            Form1.Width = Picture1.Width + 1400
            Picture1.Left = 700
            Picture1.Top = 700
         End If
      End Sub

      Private Sub cmdSingle_Click()
         'Print the picture on a single sheet. Picture object automatically
         'adjusts picture size to fit into a single sheet.
         Printer.PaintPicture Picture1.Picture, lngXCoor, lngYCoor
         Printer.EndDoc
         MsgBox "Done Sending Info to Printer"
      End Sub

      Private Sub cmdMultiple_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

