vb Code:
Public Class Form1
Dim img As Bitmap
Private Sub addPicture()
If Me.OpenFileDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then
img = New Bitmap(Me.OpenFileDialog1.FileName)
Clipboard.SetImage(img) ' set the image in the clipboard so we can paste it in the text box
textMainTextBox.Paste()
End If
End Sub
Private Sub print()
' Create the document and attach an event handler.
Dim MyDoc As New Printing.PrintDocument()
AddHandler MyDoc.PrintPage, AddressOf MyDoc_PrintPage
MyDoc.Print()
My.Application.DoEvents()
End Sub
Private Sub MyDoc_PrintPage(ByVal sender As Object, ByVal e As Printing.PrintPageEventArgs)
Using titlefont As New System.Drawing.Font("Arial", 18, FontStyle.Bold)
e.Graphics.DrawString("File Printout", titlefont, Brushes.Black, 370, 27)
End Using
Using datafont As New System.Drawing.Font("Arial", 10, FontStyle.Regular)
e.Graphics.DrawString(Me.textMainTextBox.Text, datafont, Brushes.Black, 10, 130)
End Using
e.Graphics.DrawImage(img, 10, 20)
'you might have to modify the way your text prints
'i haven't tried printing a complete rtb text
End Sub
end class