none
如何在 Windows 窗体上绘制垂直文本 RRS feed

  • 问题

  • 在MSDN上复制了一段代码,来解决如何在 Windows 窗体上绘制垂直文本,我运行了后为什么不能在窗体中显示"Sample Text"呢?


    Public Sub DrawVerticalString()
        Dim formGraphics As System.Drawing.Graphics = Me.CreateGraphics()
        Dim drawString As String = "Sample Text"
        Dim drawFont As New System.Drawing.Font("Arial", 16)
        Dim drawBrush As New _
            System.Drawing.SolidBrush(System.Drawing.Color.Black)
        Dim x As Single = 150.0
        Dim y As Single = 50.0
        Dim drawFormat As New System.Drawing.StringFormat
        drawFormat.FormatFlags = StringFormatFlags.DirectionVertical
        formGraphics.DrawString(drawString, drawFont, drawBrush, _
        x, y, drawFormat)
        drawFont.Dispose()
        drawBrush.Dispose()
        formGraphics.Dispose()
    End Sub


    visual studio 2008
    2009年2月23日 13:58

答案

全部回复