The Paint event is raised when the control is redrawn. It passes an instance of PaintEventArgs to the method that handles the Paint event.
Example:
following example requires a button control named ‘Button1’ on the windows form. In this example we will draw a rectangle and one ellipse in blue color with the help of Paint event.
Private Sub Button1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Button1.Paint Dim objPen As Pen = New Pen(Color.Blue, 2) e.Graphics.DrawRectangle(objPen, 3, 3, Button1.Width - 5, Button1.Height - 5) e.Graphics.DrawEllipse(objPen, 3, 3, Button1.Width - 5, Button1.Height - 5) End Sub