可通过
 StringFormat sF = new StringFormat(StringFormatFlags.DirectionVertical);
以及使用

  g.DrawString(s, f, Brushes.Black, rf,sF);

来绘制竖向文本

 

GDI+绘制竖向文本

 

 private void Form1_Paint(object sender, PaintEventArgs e)
        {
            Graphics g 
= e.Graphics;
            Font f 
= new Font("Aris"15, FontStyle.Italic);
            
string s = "this is my name ,and what";
            StringFormat sF 
= new StringFormat(StringFormatFlags.DirectionVertical);
            SizeF sf 
= g.MeasureString(s, f, 100);
            RectangleF rf 
= new RectangleF(2020, sf.Width, sf.Height);
            g.DrawRectangle(Pens.Red, rf.Left, rf.Top, rf.Width, rf.Height);
            g.DrawString(s, f, Brushes.Black, rf,sF);
         
        }

 

相关文章:

  • 2021-12-30
  • 2022-12-23
  • 2021-06-15
  • 2022-02-16
  • 2022-12-23
  • 2021-06-23
  • 2021-07-15
  • 2021-12-25
猜你喜欢
  • 2021-06-25
  • 2021-06-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-13
  • 2021-05-24
相关资源
相似解决方案