学海无涯

导航

绘制字体

垂直绘制字体

 

  protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            Graphics g = e.Graphics;
            //g.SmoothingMode = SmoothingMode.AntiAlias;//搞锯齿呈显

            Brush greenBrush = new SolidBrush(Color.Green);
            Rectangle rectangle = new Rectangle(20, 30, 200, 300);
            string drawString = "注塑一课";
            Font drawFont = new Font("Verdann", 14);
            StringFormat stringFormat = new StringFormat();
            stringFormat.FormatFlags = StringFormatFlags.DirectionVertical;
            stringFormat.Alignment = StringAlignment.Center;
            g.DrawString(drawString, drawFont, greenBrush, rectangle, stringFormat);

            greenBrush.Dispose();
            drawFont.Dispose();
            stringFormat.Dispose();
        }

  

posted on 2024-01-13 17:01  宁静致远.  阅读(51)  评论(0编辑  收藏  举报