using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.Drawing.Drawing2D; public class Form1 : System.Windows.Forms.Form { [STAThread] static void Main() { Application.Run(new Form1()); } protected override void OnPaint(PaintEventArgs e) { Graphics g = CreateGraphics(); string txt = "HELLO"; float alpha = 45.0f; int fontSize = 24; Point center = new Point(90, 20); FontFamily ff = new FontFamily("Times New Roman"); Font f = new Font(ff, fontSize, FontStyle.Regular); StringFormat sf = new StringFormat(); sf.FormatFlags = StringFormatFlags.DirectionVertical; g.DrawString(txt, f, new SolidBrush(Color.Blue), center, sf); g.TranslateTransform(center.X, center.Y); g.DrawEllipse(Pens.Magenta, new Rectangle(0, 0, 1, 1)); GraphicsPath gp = new GraphicsPath(); gp.AddString(txt, ff, (int)FontStyle.Bold, fontSize + 4, new Point(0, 0), sf); Matrix m = new Matrix(); m.Rotate(alpha); gp.Transform(m); g.DrawPath(Pens.Red, gp); g.RotateTransform(-alpha); g.DrawString(txt, f, new SolidBrush(Color.Black), 0, 0, sf); gp.Dispose(); g.Dispose(); m.Dispose(); } }