Highlights
All Snippets
Top 100 Snippets
Librarians
gbCodeLib

By Language
VB6
JavaScript
Perl
HTML
SQL
Java
DOS

GBIC >> Source Code >> Visual Basic >> Snippet

Print images, positioned and scaled


'in this example, print 2 inches from left, 4 inches from top, shrink picutre to 20% of original size
Dim R As Single
Printer.ScaleMode = vbInches
Picture1.ScaleMode = vbInches
R = 0.2   'reduction
Printer.PaintPicture Picture1.Picture, 2#, 4#, R * Picture1.ScaleWidth, R * Picture1.ScaleHeight
Printer.EndDoc

'in this example print a 4x4 matrix strarting in the same location
Dim R As Single , i As Long , j As Long
Printer.ScaleMode = vbInches
Picture1.ScaleMode = vbInches
R = 0.2   'reduction
For i = 1 To 4
    For j = 1 To 4
       Printer.PaintPicture Picture1.Picture, 2 + (i - 1) * R * Picture1.ScaleWidth, 4 + (j - 1) * R * Picture1.ScaleWidth, R * Picture1.ScaleWidth, R * Picture1.ScaleHeight
    Next j
Next i
Printer.EndDoc