问一下用Graphics 的DrawString 怎么画竖行的文字;
比如"文字效果"
画出来为



解决方案 »

  1.   

    // Create string to draw.
    String drawString = "Sample Text";
    // Create font and brush.
    Font drawFont = new Font("Arial", 16);
    SolidBrush drawBrush = new SolidBrush(Color.Black);
    // Create point for upper-left corner of drawing.
    PointF drawPoint = new PointF(150.0F, 50.0F);
    // Set format of string.
    StringFormat drawFormat = new StringFormat();
    drawFormat.FormatFlags = StringFormatFlags.DirectionVertical;
    // Draw string to screen.
    e.Graphics.DrawString(drawString, drawFont, drawBrush, drawPoint, drawFormat);使用 StringFormat 类来控制
      

  2.   

    应该不需要用stringFormat来控制吧?可以使用drawPoint来指定坐标吧
    drawString("摩天", New font("宋体",9,fontstyle.bold),new
    SolidBrush(Color.White),New pointF(160,50))
      

  3.   

    把字拆成数组,然后循环.加Y坐标.
     While count < linesPerPage
                line = streamToPrint.ReadLine()
                If line Is Nothing Then
                    Exit While
                End If      
                yPos = topMargin + count * printFont.GetHeight(ev.Graphics)
                ev.Graphics.DrawString(line, printFont, Brushes.Black, leftMargin, yPos, New StringFormat())
                count += 1
            End While