I\'m using the the drawstring method of Graphics class to draw a String on Image.
g.DrawString(mytext, font, brush, 0, 0);
I\'m trying to
It's not enough to just RotateTransform
or TranslateTranform
if you want to center the text. You need to offset the starting point of the text, too, by measuring it:
Bitmap bmp = new Bitmap(pictureBox1.Image);
using (Graphics g = Graphics.FromImage(bmp)) {
g.TranslateTransform(bmp.Width / 2, bmp.Height / 2);
g.RotateTransform(30);
SizeF textSize = g.MeasureString("hi", font);
g.DrawString("hi", font, Brushes.Red, -(textSize.Width / 2), -(textSize.Height / 2));
}
From How to rotate Text in GDI+?