VB.NET - Draw Text on a Windows Form



Draws text on a form.

'Assembly: System.Drawing.dll
'Assembly: System.Windows.Forms.dll

'Namespace: System
'Namespace: Microsoft.VisualBasic
'Namespace: System.Drawing
'Namespace: System.Windows.Forms

'Dim text AS String = ""hello""
'Dim form AS System.Windows.Forms.Form = "Me"

    Dim drawFormat As New StringFormat()

    Using formGraphics As Graphics = form.CreateGraphics(), _
        drawFont As New System.Drawing.Font(FontName, FontSize), _
        drawBrush As New SolidBrush(color)

        formGraphics.DrawString(text, drawFont, drawBrush, _
            Xlocation, Ylocation, drawFormat)
    End Using

Share |

 Cant find the page you are looking for?
 Help us to improve by adding the content that you are looking for.
 Leave a feedback
 We look forward to hear your comments and feedback.