How to draw string on the form in VB.Net

By James J

Draw your given string on the form

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim StringFormat As New StringFormat()

        Using DrawGrapphicString
As Graphics = Me.CreateGraphics(), _
            StringFont
As New System.Drawing.Font("Impact", 16), _
            StringBrush
As New SolidBrush(Color.Red)

             DrawGrapphicString.
DrawString("Demo of draw string by James J", StringFont, StringBrush, _
                12.0, 12.0,
StringFormat)
        
End Using
End Sub

>See below image

How to draw string on the form in VB.Net  (570 Views)