| ' Print the PictureBox's picture with upper left
' corner at (1440, 1440). Then draw a box around
' the picture.
Private Sub cmdPrint_Click()
Dim wid As Single
Dim hgt As Single
    ' Set the PictureBox's ScaleMode to pixels to
    ' make things interesting.
    picCanvas.ScaleMode = vbPixels
    ' Print the picture.
    Printer.PaintPicture picCanvas.Picture, _
        1440, 1440
    ' Get the picture's dimensions in the printer's scale
    ' mode.
    wid = ScaleX(picCanvas.ScaleWidth, picCanvas.ScaleMode, _
        Printer.ScaleMode)
    hgt = ScaleY(picCanvas.ScaleHeight, _
        picCanvas.ScaleMode, Printer.ScaleMode)
    ' Draw the box.
    Printer.Line (1440, 1440)-Step(wid, hgt), , B
    ' Finish printing.
    Printer.EndDoc
    MsgBox "Done"
End Sub |