Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27469

VS 2005 Printing Contents of RTB

$
0
0
I am using the following code to print some images, lables and now want to incorporate printing the contents of an RTB. The problem is is the user does NOT use the enter key to start a new line the contents print as one long line

I do not want to use PowerPacks printing thannks for any help


Code:

Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
        Dim img1 As Image = PictureBox1.Image
        Dim printArea1 As New RectangleF(1, 1, 5, 3.0) 'dimensions in inches
        Dim img2 As Image = PictureBox2.Image
        Dim printArea2 As New RectangleF(4.5, 4.5, 5, 3.0) 'dimensions in inches
        Dim img3 As Image = PictureBox3.Image
        Dim printArea3 As New RectangleF(8, 8, 5, 3.0) 'dimensions in inches

        Dim f As New Font("Times New Roman", 14, FontStyle.Underline)
        Dim g As New Font("Times New Roman", 14, FontStyle.Regular)
        Dim b As New SolidBrush(Color.Black)
        Dim c As Integer = 60
        Dim xRes As Single = 90 'img1.HorizontalResolution / 2
        Dim yRes As Single = 90 'img1.VerticalResolution / 2
        e.Graphics.DrawImage(img1, printArea1.X * xRes, printArea1.Y * yRes, printArea1.Width * xRes, printArea1.Height * yRes)
        e.Graphics.DrawImage(img2, printArea1.X * xRes, printArea2.Y * yRes, printArea2.Width * xRes, printArea2.Height * yRes)
        e.Graphics.DrawImage(img3, printArea1.X * xRes, printArea3.Y * yRes, printArea3.Width * xRes, printArea3.Height * yRes)
        e.Graphics.DrawString(Label1.Text, f, b, 600, 150)
        e.Graphics.DrawString(Label2.Text, f, b, 600, 450)
        e.Graphics.DrawString(Label3.Text, f, b, 600, 750)

        e.Graphics.DrawString(RichTextBox1.Text, g, b, 600, 250)
        e.Graphics.DrawString(RichTextBox2.Text, g, b, 600, 600)
        e.Graphics.DrawString(RichTextBox3.Text, g, b, 600, 850)
       
    End Sub


Viewing all articles
Browse latest Browse all 27469

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>