PrintImage Example VB

This example prints the image that is currently displayed in the Image Edit control.  It uses the Print Dialog box in the Admin control to obtain parameters for the print out.

Private Sub cmdPrint_Click()
    On Error GoTo PrintErr
    'Display an image
    ImgEdit1.Image = "D:\image2\4page.tif"
    ImgEdit1.Display
   
    'Set filename to be printed to the displayed file.
    'If this property is not set the dialog will not display
    ImgAdmin1.Image = ImgEdit1.Image
    ImgAdmin1.ShowPrintDialog
    
    ImgEdit1.PrintImage ImgAdmin1.PrintStartPage, ImgAdmin1.PrintEndPage,
     ImgAdmin1.PrintOutputFormat, ImgAdmin1.PrintAnnotations
        
PrintErr:
     'User pressed the cancel button
     Exit Sub
End Sub