Drawing Text on a Windows Form using the Draw Method of Graphics Class.

Chikul
Posted by Chikul under Windows Forms category on | Views : 1800
'Drawing Text on a Windows Form using the Draw Method of Graphics Class.

Public Class frmDrawMethod

Private Sub frmDrawText_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
'Create the Object of Graphics Class
Dim grpx As Graphics = e.Graphics
grpx.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias

'Create Pen Object.
Dim penRed As Pen = New Pen(Color.Red, 20)
Dim penYellow As Pen = New Pen(Color.Yellow, 12)

'call Draw methods
grpx.DrawLine(Pens.Black, 25, 150, 250, 130)
grpx.DrawEllipse(penYellow, 20, 15, 100, 100)
grpx.DrawRectangle(penRed, 150, 10, 100, 100)

End Sub

End Class

Comments or Responses

Login to post response