C# 用graphics画图,想实现任何角度的旋转,但是旋转180度时,字体也会旋转为倒着的,有什么办法让字体变成正的呢?试过很多方法都不行,有没有办法找到旋转后字体的坐标,然后再旋转回来?谢谢,跪求

解决方案
10
30
给你个方法供参考
protected override void OnPaint(PaintEventArgs e) { var g = e.Graphics; g.SmoothingMode = SmoothingMode.AntiAlias; g.TranslateTransform(ClientRectangle.Width / 2, ClientRectangle.Height / 2); for (var a = 0; a < 360; a += 30) { using (var p = new GraphicsPath()) { g.DrawLine(Pens.Black, 0, 0, 140, 0); p.AddString("方向角" + a, new FontFamily("幼圆"), 1, 10, new Point(50, 2), new StringFormat()); if (a > 90 && a<270) { p.Transform(new Matrix(-1, 0, 0, -1, 150, 0)); } g.FillPath(Brushes.Black, p); g.RotateTransform(30); } } }