Public Class Parabola ' margin around picture in pixels Const MARGINSIZE As Integer = 10 ' grid size for strings in pixels Const STEPSIZE As Integer = 10 ' paint handler Private Sub Parabola_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint ' get size of client area Dim client As Size = ClientSize ' calculate co-ordinates of plot Dim xl As Integer = MARGINSIZE Dim xr As Integer = client.Width - MARGINSIZE Dim yt As Integer = MARGINSIZE Dim yb As Integer = client.Height - MARGINSIZE ' calculate how many steps fit down the screen Dim size = STEPSIZE * ((yb - yt) \ STEPSIZE) ' draw the lines For i As Integer = 0 To size Step STEPSIZE e.Graphics.DrawLine(Pens.Blue, xl, yb - i, xl + size - i, yb) Next End Sub ' handle form size changed event Private Sub Parabola_Resize(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Resize Refresh() End Sub End Class