Stampare una Immagine o una Lista in VB net : Print an Image or a List in VB net

IL codice : the Code. In qusto caso il codice stampa quello che trova in una PictureBox ( pictureboxstampa) che puo' essere invisibile e assumere cosi' il postro di mediano fra il file originale ed il finale, a cui si potrebbe cambiare l'estensione....In this case the code prints what it finds in a PictureBox (pictureboxstampa) which can be invisible and thus assume the median post between the original and the final file, to which the extension could be changed ....

Private Sub StampaImmaginePicture()

' Assumes the default printer.
Dim pd As New System.Drawing.Printing.PrintDocument
AddHandler pd.PrintPage, AddressOf Me.pd_PrintPagePicture
Dim ppd As New PrintPreviewDialog
ppd.Document = pd
ppd.WindowState = FormWindowState.Maximized
ppd.ShowDialog()

End Sub

Private Sub pd_PrintPagePicture(ByVal sender As Object, ByVal ev As System.Drawing.Printing.PrintPageEventArgs)

If Stampa_ = "immaginefiles" Then
PictureBoxStampa.Image = Image.FromFile(ListBoxFiles.Items(ListBoxFiles.SelectedIndex))
ev.Graphics.DrawImage(Image.FromFile(ListBoxFiles.Items(ListBoxFiles.SelectedIndex)), 10,
10, PictureBoxStampa.Image.Width, PictureBoxStampa.Image.Height)
ElseIf Stampa_ = "imamaginerisultati" Then
PictureBoxStampa.Image = Image.FromFile(ListBoxRisultati.Items(ListBoxRisultati.SelectedIndex))
ev.Graphics.DrawImage(Image.FromFile(ListBoxRisultati.Items(ListBoxRisultati.SelectedIndex)), 10,
10, PictureBoxStampa.Image.Width, PictureBoxStampa.Image.Height)
End If

' Indicate that this is the last page to print.
ev.HasMorePages = False
End Sub