Render example for Access 95 and 97

This example demonstrates the Render method.

' Declare local variables
Dim HeightFactor, WidthFactor, HeightAllowed, WidthAllowed
Dim ControlWidth, ControlHeight, MyPrinter

' Set the variables used for preserving the aspect ratio.
HeightFactor = Lead1.BitmapHeight
WidthFactor = Lead1.BitmapWidth

' Allow a maximum of 6x6 inches on a 300dpi printer
HeightAllowed = 1800
WidthAllowed = 1800

' Print the LEAD control, preserving the aspect ratio.
' Check to see if using the maximum width will make the image too tall.
' Set the dimensions based on the result.
If ((WidthAllowed * HeightFactor) / WidthFactor) < HeightAllowed Then
    ControlWidth = WidthAllowed
    ControlHeight = (ControlWidth * HeightFactor) / WidthFactor
Else
    ControlHeight = HeightAllowed
    ControlWidth = (ControlHeight * WidthFactor) / HeightFactor
End If

MyPrinter = Lead1.PrintStart
Lead1.Render MyPrinter, 0, 0, ControlWidth, ControlHeight
Lead1.PrintEnd MyPrinter