Rotate text on PrintPreview using C# and VB.Net in Windows Application

Last Reply 8 months ago By dharmendr

Posted 8 months ago

Hi 

Working in vb.net and using printDcoument with PrintPreviewDialog 

Everything working fine, but text I want to rotate my text on print preview 

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        If CheckBox1.Checked = True Then
            PrintDocument1.DefaultPageSettings.Landscape = True
        End If
        If PrintPreviewDialog1.ShowDialog = DialogResult.OK Then

            PrintDocument1.Print()
        End If
    End Sub

    Private Sub PrintDocument1_PrintPage(sender As Object, e As Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
        ' TextBox1.CreateGraphics.RotateTransform(90)

        e.Graphics.DrawString(TextBox1.Text, New Font("Time New Romans", 14, FontStyle.Bold), Brushes.Black, New PointF(300, 400))


        e.Graphics.DrawString(TextBox2.Text, New Font("Time New Romans", 14, FontStyle.Bold), Brushes.Black, New PointF(300, 430))
        'ate 45° clockwise
        e.Graphics.RotateTransform(90)

        e.Graphics.ResetTransform()

    End Sub

 

This question does not have replies that have been liked.