Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim pen As New Pen(Color.Red) Using g As Graphics = Me.CreateGraphics g.DrawRectangle(pen, 0, 10, 100, 100) g.DrawLine(pen, 0, 20, 200, 0) End Using End Sub End Class