VB.NET Can't rotate string in image

Viewed 133

I want to rotate the string in the image but can't do it, can anybody help me, i tried "drawformat" but it doesn't rotate but just center. I want rotate B in Case "K-11" 90 degrees, B 45 degrees and C 90 degrees in "K-21" or somethings like that. Thank you very much.

Public Class ImageRebartoRevit
    Private Sub OK_Click(sender As Object, e As EventArgs) Handles OK.Click
        xuat_shapcode_revit(ShapeCode.Text)
    End Sub
    Function xuat_shapcode_revit(shapecode As String) As Boolean
        Dim newBitmap As Bitmap
        newBitmap = New Bitmap("C:\Users\ADMIN\Desktop\IMG\" + shapecode + ".png")
        Dim Graphics As Graphics
        Dim A As String = L1.Text
        Dim B As String = L2.Text
        Dim C As String = L3.Text        
        Graphics = Graphics.FromImage(newBitmap)

        Dim drawformat As New StringFormat()
        drawformat.Alignment = StringAlignment.Center

        Select Case shapecode
            Case "K-00"
                Graphics.DrawString(A, New Font("Arial", 50, FontStyle.Regular), New SolidBrush(Color.Black), New Point(470, 90), drawformat)
            Case "K-11"
                Graphics.DrawString(A.ToString, New Font("Arial", 50, FontStyle.Regular), New SolidBrush(Color.Black), New Point(843, 128), drawformat)
                Graphics.DrawString(B.ToString, New Font("Arial", 50, FontStyle.Regular), New SolidBrush(Color.Black), New Point(457, 124), drawformat)
            Case "K-21"
                Graphics.DrawString(A.ToString, New Font("Arial", 50, FontStyle.Regular), New SolidBrush(Color.Black), New Point(75, 139), drawformat)
                Graphics.DrawString(B.ToString, New Font("Arial", 50, FontStyle.Regular), New SolidBrush(Color.Black), New Point(467, 124), drawformat)
                Graphics.DrawString(C.ToString, New Font("Arial", 50, FontStyle.Regular), New SolidBrush(Color.Black), New Point(859, 139), drawformat)
            
        End Select
        newBitmap.Save("C:\Users\ADMIN\Desktop\IMG\out_put_" + shapecode + ".bmp", System.Drawing.Imaging.ImageFormat.Jpeg)
        Return True
    End Function
End Class
1 Answers
            Graphics.DrawString(A.ToString, New Font("Arial", 50, FontStyle.Regular), New SolidBrush(Color.Black), New Point(220, 215), drawformat)

            Graphics1.TranslateTransform(50, 230)
            Graphics1.RotateTransform(-29)
            Graphics1.DrawString(B.ToString, New Font("Arial", 50, FontStyle.Regular), New SolidBrush(Color.Black), New Point(408, 119), drawformat)

            Graphics.DrawString(C.ToString, New Font("Arial", 50, FontStyle.Regular), New SolidBrush(Color.Black), New Point(820, 45), drawformat)

            Graphics2.TranslateTransform(910, 1010)
            Graphics2.RotateTransform(-90)
            Graphics2.DrawString(D.ToString, New Font("Arial", 50, FontStyle.Regular), New SolidBrush(Color.Black), New Point(940, 40), drawformat)

Hi everyone, I figured it out and done it, did you guys see the best way?

Related