How do I draw rotated text

Platform: WinForms| Category: Drawing Tips
  private void pictureBox1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
  {
    Graphics g = e.Graphics;

    g.TranslateTransform(100.0f, 100.0f);
    g.RotateTransform(-90.0f);
    g.DrawString('Vertical Text', Font, Brushes.Blue, 0.0f, 0.0f);
    g.ResetTransform();

    g.TranslateTransform(100.0f, 100.0f);
    g.RotateTransform(-45.0f);
    g.DrawString('Slanted Text', new Font(Font, FontStyle.Bold), Brushes.Red, 0.0f, 0.0f);
    g.ResetTransform();

  }

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.