Dim g As System.Drawing.Graphics
Dim pen1 As New System.Drawing.Pen(Color.Blue, 2)
Private Sub butLine_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butLine.Click
g = PictureBox1.CreateGraphics
g.DrawLine(pen1, 250, 50, 400, 200)
End Sub
Private Sub butEllipse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butEllipse.Click
g = PictureBox1.CreateGraphics
g.DrawEllipse(pen1, 50, 50, 100, 150)
End Sub
Private Sub butRect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butRect.Click
g = PictureBox1.CreateGraphics
g.DrawRectangle(pen1, 30, 30, 50, 60)
End Sub
Private Sub butArc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butArc.Click
g = PictureBox1.CreateGraphics
g.DrawArc(pen1, 150, 100, 150, 200, 150, 160)
End Sub
Private Sub butPie_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butPie.Click
g = PictureBox1.CreateGraphics
g.DrawPie(pen1, 50, 50, 150, 150, 0, 170)
End Sub
Private Sub butPoly_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butPoly.Click
Dim p(5) As System.Drawing.Point
p(0).X = 0
p(0).Y = 0
p(1).X = 53
p(1).Y = 111
p(2).X = 114
p(2).Y = 86
p(3).X = 34
p(3).Y = 34
p(4).X = 165
p(4).Y = 7
g = PictureBox1.CreateGraphics
g.DrawPolygon(pen1, p)
End Sub
Private Sub butBez_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butBez.Click
g = PictureBox1.CreateGraphics
g.DrawBezier(pen1, 100, 200, 240, 250, 100, 200, 150, 30)
End Sub
Private Sub butClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butClear.Click
PictureBox1.Refresh()
End Sub
End Class