borderAndreaVB free resources for Visual Basic developersborder

AndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2008 Andrea Tincani
:: Print an Image contained in a Picture Box or a Form

Author  

Andrea Tincani

Language  

VB5, VB6

Operating Systems  

Windows 95, 98 and NT
Module

'Print the Picture contained in a PictureBox or a Form
Public Sub PrintImage(p As IPictureDisp, Optional ByVal x, Optional ByVal y, Optional ByVal resize)
    If IsMissing(x) Then x = Printer.CurrentX
    If IsMissing(y) Then y = Printer.CurrentY
    If IsMissing(resize) Then resize = 1
    Printer.PaintPicture p, x, y, p.Width * resize, p.Height * resize
End Sub

Usage

'Usage:
Private Sub Command1_Click()
   
'Print the image loaded in Picture1 (real size)
    PrintImage Picture1.Picture
   
'Print the image loaded in Picture1 (half size)
    PrintImage Picture1.Picture, , , 0.5
   
'Print the image loaded in Picture1 (double size)
    PrintImage Picture1.Picture, , , 0.5
End Sub

:: Navigation

Home

Printing Using Visual Basic

Previous Tip

Next Tip

:: Search this site
Google
:: Related Topics
icon 14-12-2006 Re: Need to print Logo on the top (which changes) by jamess
icon 14-12-2006 Re: Need to print Logo on the top (which changes) by admin
icon 19-03-2004 Re: Picture prints as black Square by Gillam
Partners: Il portale per lui e lei | Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2008 Andrea Tincaniborder